mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
reciprocated makeAuthInfoBytes function changes
This commit is contained in:
parent
5a40cdd3bb
commit
45ee5fe15a
@ -79,7 +79,8 @@ async function sendTokens(
|
||||
},
|
||||
];
|
||||
const gasLimit = 200000;
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit);
|
||||
const feePayer = "";
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, feePayer);
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
|
@ -203,7 +203,8 @@ describe("CosmWasmClient", () => {
|
||||
};
|
||||
const txBodyBytes = registry.encode(txBody);
|
||||
const gasLimit = Int53.fromString(fee.gas).toNumber();
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
|
||||
const feePayer = ""
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit, feePayer);
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const { signed, signature } = await wallet.signDirect(alice.address0, signDoc);
|
||||
const txRaw = TxRaw.fromPartial({
|
||||
|
@ -582,10 +582,12 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
const signedTxBodyBytes = this.registry.encode(signedTxBody);
|
||||
const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
|
||||
const signedSequence = Int53.fromString(signed.sequence).toNumber();
|
||||
const signedFeePayer = ""
|
||||
const signedAuthInfoBytes = makeAuthInfoBytes(
|
||||
[{ pubkey, sequence: signedSequence }],
|
||||
signed.fee.amount,
|
||||
signedGasLimit,
|
||||
signedFeePayer,
|
||||
signMode,
|
||||
);
|
||||
return TxRaw.fromPartial({
|
||||
@ -619,7 +621,8 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
};
|
||||
const txBodyBytes = this.registry.encode(txBody);
|
||||
const gasLimit = Int53.fromString(fee.gas).toNumber();
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
|
||||
const feePayer = fee.granter == undefined ? "" : fee.granter
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit, feePayer);
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc);
|
||||
return TxRaw.fromPartial({
|
||||
|
@ -225,6 +225,7 @@ export class ModifyingDirectSecp256k1HdWallet extends DirectSecp256k1HdWallet {
|
||||
}));
|
||||
const modifiedFeeAmount = coins(3000, "ucosm");
|
||||
const modifiedGasLimit = 333333;
|
||||
const modifiedFeePayer = "";
|
||||
const modifiedSignDoc = {
|
||||
...signDoc,
|
||||
bodyBytes: Uint8Array.from(TxBody.encode(modifiedTxBody).finish()),
|
||||
@ -232,6 +233,7 @@ export class ModifyingDirectSecp256k1HdWallet extends DirectSecp256k1HdWallet {
|
||||
signers,
|
||||
modifiedFeeAmount,
|
||||
modifiedGasLimit,
|
||||
modifiedFeePayer,
|
||||
SignMode.SIGN_MODE_DIRECT,
|
||||
),
|
||||
};
|
||||
|
@ -261,10 +261,11 @@ describe("DirectSecp256k1HdWallet", () => {
|
||||
};
|
||||
const fee = coins(2000, "ucosm");
|
||||
const gasLimit = 200000;
|
||||
const feePayer = ""
|
||||
const chainId = "simd-testing";
|
||||
const signDoc = makeSignDoc(
|
||||
fromHex(bodyBytes),
|
||||
makeAuthInfoBytes([{ pubkey, sequence }], fee, gasLimit),
|
||||
makeAuthInfoBytes([{ pubkey, sequence }], fee, gasLimit, feePayer),
|
||||
chainId,
|
||||
accountNumber,
|
||||
);
|
||||
|
@ -44,9 +44,10 @@ describe("DirectSecp256k1Wallet", () => {
|
||||
const fee = coins(2000, "ucosm");
|
||||
const gasLimit = 200000;
|
||||
const chainId = "simd-testing";
|
||||
const feePayer = "";
|
||||
const signDoc = makeSignDoc(
|
||||
fromHex(bodyBytes),
|
||||
makeAuthInfoBytes([{ pubkey, sequence }], fee, gasLimit),
|
||||
makeAuthInfoBytes([{ pubkey, sequence }], fee, gasLimit, feePayer),
|
||||
chainId,
|
||||
accountNumber,
|
||||
);
|
||||
|
@ -362,10 +362,12 @@ export class SigningStargateClient extends StargateClient {
|
||||
const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
|
||||
const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
|
||||
const signedSequence = Int53.fromString(signed.sequence).toNumber();
|
||||
const signedFeePayer = signed.fee.granter == undefined ? "" : signed.fee.granter
|
||||
const signedAuthInfoBytes = makeAuthInfoBytes(
|
||||
[{ pubkey, sequence: signedSequence }],
|
||||
signed.fee.amount,
|
||||
signedGasLimit,
|
||||
signedFeePayer,
|
||||
signMode,
|
||||
);
|
||||
return TxRaw.fromPartial({
|
||||
@ -399,7 +401,8 @@ export class SigningStargateClient extends StargateClient {
|
||||
};
|
||||
const txBodyBytes = this.registry.encode(txBodyEncodeObject);
|
||||
const gasLimit = Int53.fromString(fee.gas).toNumber();
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
|
||||
const feePayer = fee.granter == undefined ? "" : fee.granter
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit, feePayer);
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc);
|
||||
return TxRaw.fromPartial({
|
||||
|
@ -74,7 +74,8 @@ async function sendTokens(
|
||||
},
|
||||
];
|
||||
const gasLimit = 200000;
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit);
|
||||
const feePayer = "";
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, feePayer);
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
|
@ -364,7 +364,8 @@ describe("StargateClient", () => {
|
||||
const { accountNumber, sequence } = (await client.getSequence(address))!;
|
||||
const feeAmount = coins(2000, "ucosm");
|
||||
const gasLimit = 200000;
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit);
|
||||
const feePayer = "";
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, feePayer);
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
@ -421,7 +422,8 @@ describe("StargateClient", () => {
|
||||
const { accountNumber, sequence } = (await client.getSequence(address))!;
|
||||
const feeAmount = coins(2000, "ucosm");
|
||||
const gasLimit = 200000;
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, sequence);
|
||||
const feePayer = "";
|
||||
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, feePayer, sequence);
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
@ -482,9 +484,10 @@ describe("StargateClient", () => {
|
||||
const chainId = await client.getChainId();
|
||||
const feeAmount = coins(2000, "ucosm");
|
||||
const gasLimit = 200000;
|
||||
const feePayer = "";
|
||||
|
||||
const { accountNumber: accountNumber1, sequence: sequence1 } = (await client.getSequence(address))!;
|
||||
const authInfoBytes1 = makeAuthInfoBytes([{ pubkey, sequence: sequence1 }], feeAmount, gasLimit);
|
||||
const authInfoBytes1 = makeAuthInfoBytes([{ pubkey, sequence: sequence1 }], feeAmount, gasLimit, feePayer);
|
||||
const signDoc1 = makeSignDoc(txBodyBytes, authInfoBytes1, chainId, accountNumber1);
|
||||
const { signature: signature1 } = await wallet.signDirect(address, signDoc1);
|
||||
const txRaw1 = TxRaw.fromPartial({
|
||||
@ -498,7 +501,7 @@ describe("StargateClient", () => {
|
||||
assertIsDeliverTxSuccess(txResult);
|
||||
|
||||
const { accountNumber: accountNumber2, sequence: sequence2 } = (await client.getSequence(address))!;
|
||||
const authInfoBytes2 = makeAuthInfoBytes([{ pubkey, sequence: sequence2 }], feeAmount, gasLimit);
|
||||
const authInfoBytes2 = makeAuthInfoBytes([{ pubkey, sequence: sequence2 }], feeAmount, gasLimit, feePayer);
|
||||
const signDoc2 = makeSignDoc(txBodyBytes, authInfoBytes2, chainId, accountNumber2);
|
||||
const { signature: signature2 } = await wallet.signDirect(address, signDoc2);
|
||||
const txRaw2 = TxRaw.fromPartial({
|
||||
|
@ -234,6 +234,7 @@ export class ModifyingDirectSecp256k1HdWallet extends DirectSecp256k1HdWallet {
|
||||
}));
|
||||
const modifiedFeeAmount = coins(3000, "ucosm");
|
||||
const modifiedGasLimit = 333333;
|
||||
const modifiedFeePayer = "";
|
||||
const modifiedSignDoc = {
|
||||
...signDoc,
|
||||
bodyBytes: Uint8Array.from(TxBody.encode(modifiedTxBody).finish()),
|
||||
@ -241,6 +242,7 @@ export class ModifyingDirectSecp256k1HdWallet extends DirectSecp256k1HdWallet {
|
||||
signers,
|
||||
modifiedFeeAmount,
|
||||
modifiedGasLimit,
|
||||
modifiedFeePayer,
|
||||
SignMode.SIGN_MODE_DIRECT,
|
||||
),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user