Skip to content

Commit

Permalink
Update @cosmjs/* and cosmjs-types to latest (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbarry authored Feb 22, 2024
1 parent 1ae18f2 commit c695fbf
Show file tree
Hide file tree
Showing 11 changed files with 754 additions and 546 deletions.
16 changes: 16 additions & 0 deletions .changeset/silver-plants-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"abstraxion-dashboard": minor
"@burnt-labs/abstraxion-core": minor
"@burnt-labs/abstraxion": minor
"@burnt-labs/signers": minor
"demo-app": minor
---
Update the following packages to the latest version:

| Package | Version |
|-----------------------------|------------|
| @cosmjs/cosmwasm-stargate | ^0.32.2 |
| @cosmjs/proto-signing | ^0.32.2 |
| @cosmjs/stargate | ^0.32.2 |
| @cosmjs/tendermint-rpc | ^0.32.2 |
| cosmjs-types | ^0.9.0 |
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const AbstraxionGrant = ({
typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit",
value: MaxCallsLimit.encode(
MaxCallsLimit.fromPartial({
remaining: "255",
remaining: BigInt("255"),
}),
).finish(),
},
Expand All @@ -84,7 +84,7 @@ export const AbstraxionGrant = ({
typeUrl: "/cosmwasm.wasm.v1.CombinedLimit",
value: CombinedLimit.encode(
CombinedLimit.fromPartial({
callsRemaining: "255",
callsRemaining: BigInt("255"),
amounts,
}),
).finish(),
Expand All @@ -103,7 +103,7 @@ export const AbstraxionGrant = ({
value: contractExecutionAuthorizationValue,
},
expiration: {
seconds: timestampThreeMonthsFromNow,
seconds: BigInt(timestampThreeMonthsFromNow),
},
},
grantee,
Expand Down
6 changes: 3 additions & 3 deletions apps/abstraxion-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"@burnt-labs/signers": "workspace:*",
"@burnt-labs/tailwind-config": "workspace:*",
"@burnt-labs/ui": "workspace:*",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@sentry/nextjs": "^7.100.1",
"@stytch/nextjs": "^14.0.0",
"@stytch/vanilla-js": "^3.2.1",
"@tanstack/react-query": "^4.36.1",
"@vercel/analytics": "^1.1.3",
"cosmjs-types": "^0.8.0",
"cosmjs-types": "^0.9.0",
"graz": "^0.0.51",
"jose": "^5.1.3",
"next": "^14.0.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@burnt-labs/abstraxion": "workspace:*",
"@burnt-labs/signers": "workspace:*",
"@burnt-labs/ui": "workspace:*",
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"next": "^14.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
12 changes: 6 additions & 6 deletions packages/abstraxion-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
},
"devDependencies": {
"@burnt-labs/eslint-config-custom": "workspace:*",
"@burnt-labs/signers": "workspace:*",
"@burnt-labs/tailwind-config": "workspace:*",
"@burnt-labs/tsconfig": "workspace:*",
"@burnt-labs/signers": "workspace:*",
"autoprefixer": "^10.4.13",
"rimraf": "^5.0.5",
"tsup": "^6.0.1",
"typescript": "^5.2.2"
},
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"cosmjs-types": "^0.8.0",
"@cosmjs/tendermint-rpc": "^0.31.1",
"@burnt-labs/constants": "workspace:*",
"@burnt-labs/signers": "workspace:*",
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"cosmjs-types": "^0.9.0",
"graz": "^0.0.51",
"jose": "^5.1.3"
}
Expand Down
20 changes: 10 additions & 10 deletions packages/abstraxion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@burnt-labs/abstraxion-core": "workspace:*",
"@burnt-labs/constants": "workspace:*",
"@burnt-labs/signers": "workspace:*",
"@burnt-labs/abstraxion-core": "workspace:*",
"@burnt-labs/ui": "workspace:*",
"@cosmjs/amino": "^0.31.3",
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/crypto": "^0.31.3",
"@cosmjs/amino": "^0.32.2",
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"@cosmjs/crypto": "^0.32.2",
"@cosmjs/encoding": "^0.32.2",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.1",
"@cosmjs/utils": "^0.31.3",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"@cosmjs/utils": "^0.32.2",
"@keplr-wallet/cosmos": "^0.12.67",
"@keplr-wallet/crypto": "^0.12.69",
"@types/react-dom": "^18.2.18",
"cosmjs-types": "^0.8.0",
"cosmjs-types": "^0.9.0",
"graz": "^0.0.51",
"jose": "^5.1.3"
}
}
}
17 changes: 9 additions & 8 deletions packages/signers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
},
"dependencies": {
"@apollo/client": "^3.8.8",
"@cosmjs/amino": "^0.31.3",
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/crypto": "^0.31.3",
"@cosmjs/amino": "^0.32.2",
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"@cosmjs/crypto": "^0.32.2",
"@cosmjs/math": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.3",
"@cosmjs/utils": "^0.31.3",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"@cosmjs/utils": "^0.32.2",
"@protobuf-ts/runtime": "^2.9.3",
"bech32": "^2.0.0",
"cosmjs-types": "^0.8.0",
"cosmjs-types": "^0.9.0",
"graphql": "^16.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
18 changes: 9 additions & 9 deletions packages/signers/src/signers/utils/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class AAClient extends SigningCosmWasmClient {
public static async connectWithSigner(
endpoint: string,
signer: AASigner,
options: SigningStargateClientOptions = {}
options: SigningStargateClientOptions = {},
): Promise<AAClient> {
const tmClient = await Tendermint37Client.connect(endpoint);
return new AAClient(tmClient, signer, {
Expand All @@ -59,7 +59,7 @@ export class AAClient extends SigningCosmWasmClient {
protected constructor(
tmClient: Tendermint37Client | undefined,
signer: AASigner,
options: SigningStargateClientOptions
options: SigningStargateClientOptions,
) {
super(tmClient, signer, options);
this.abstractSigner = signer;
Expand All @@ -71,7 +71,7 @@ export class AAClient extends SigningCosmWasmClient {
* @returns
*/
public async registerAbstractAccount(
msg: MsgRegisterAccount
msg: MsgRegisterAccount,
): Promise<DeliverTxResponse> {
const { sender } = msg;
const createMsg: MsgRegisterAccountEncodeObject = {
Expand All @@ -89,7 +89,7 @@ export class AAClient extends SigningCosmWasmClient {
public async addAbstractAccountAuthenticator(
msg: AddAuthenticator,
memo = "",
fee: StdFee
fee: StdFee,
): Promise<DeliverTxResponse> {
if (!this.abstractSigner.abstractAccount) {
throw new Error("Abstract account address not set in signer");
Expand Down Expand Up @@ -135,7 +135,7 @@ export class AAClient extends SigningCosmWasmClient {
messages: readonly EncodeObject[],
fee: StdFee,
memo: string,
explicitSignerData?: SignerData
explicitSignerData?: SignerData,
): Promise<TxRaw> {
const aaAcount = await this.getAccount(signerAddress);
// we want to use the normal signingstargate client sign method if the signer is not an AASigner
Expand All @@ -151,7 +151,7 @@ export class AAClient extends SigningCosmWasmClient {
}
/// This check simply makes sure the signer is an AASigner and not a regular signer
const accountFromSigner = (await this.abstractSigner.getAccounts()).find(
(account) => account.address === signerAddress
(account) => account.address === signerAddress,
);

if (!accountFromSigner) {
Expand All @@ -175,7 +175,7 @@ export class AAClient extends SigningCosmWasmClient {
}

const pubKeyBytes = bech32.fromWords(
bech32.decode(accountFromSigner.address).words
bech32.decode(accountFromSigner.address).words,
);

const txBodyEncodeObject = {
Expand All @@ -193,7 +193,7 @@ export class AAClient extends SigningCosmWasmClient {
bodyBytes,
authInfoBytes,
chainId: signerData.chainId,
accountNumber: aaAcount.accountNumber,
accountNumber: BigInt(aaAcount.accountNumber),
});
const signature = await this.abstractSigner
.signDirect(accountFromSigner.accountAddress, signDoc)
Expand All @@ -203,7 +203,7 @@ export class AAClient extends SigningCosmWasmClient {
new Uint8Array([
accountFromSigner.authenticatorId,
...Buffer.from(sig.signature.signature, "base64"),
])
]),
).toString("base64");
});
return TxRaw.fromPartial({
Expand Down
18 changes: 11 additions & 7 deletions packages/signers/src/signers/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,21 @@ export type INodes<T> = {
nodes: Array<T>;
};

function uint64FromProto(input: number | bigint): Uint64 {
return Uint64.fromString(input.toString());
}

function accountFromBaseAccount(input: BaseAccount) {
const { address, pubKey, accountNumber, sequence } = input;
let pubkey: Pubkey | null = null;
if (pubKey) {
pubkey = decodePubkey(pubKey);
}
return {
address: address,
pubkey: pubkey,
accountNumber: Uint64.fromString(accountNumber.toString()).toNumber(),
sequence: Uint64.fromString(sequence.toString()).toNumber(),
address,
pubkey,
accountNumber: uint64FromProto(accountNumber).toNumber(),
sequence: uint64FromProto(sequence).toNumber(),
};
}

Expand All @@ -69,7 +73,7 @@ export function customAccountFromAny(input: Any): Account {
const { typeUrl, value } = input;
switch (typeUrl) {
case "/abstractaccount.v1.AbstractAccount": {
const abstractAccount = AbstractAccount.decode(value);
const abstractAccount = AbstractAccount.fromBinary(value);
assert(abstractAccount);
return accountFromBaseAccount(abstractAccount);
}
Expand Down Expand Up @@ -103,14 +107,14 @@ export function makeAAuthInfo(
mode: SignMode.SIGN_MODE_DIRECT,
},
},
sequence: account.sequence,
sequence: BigInt(account.sequence),
}),
],
fee: {
amount: fee.amount
? coins(fee.amount[0].amount, fee.amount[0].denom)
: coins(1, "uxion"),
gasLimit: fee.gas,
gasLimit: BigInt(fee.gas),
granter: fee.granter || "",
payer: fee.payer || "",
},
Expand Down
Loading

0 comments on commit c695fbf

Please sign in to comment.