stargate: Update for new OfflineSigner
This commit is contained in:
parent
e3069e35a1
commit
716f318bd9
@ -4,8 +4,8 @@ import { Coin, coins } from "@cosmjs/launchpad";
|
||||
import {
|
||||
DirectSecp256k1Wallet,
|
||||
encodePubkey,
|
||||
makeAuthInfo,
|
||||
makeSignBytes,
|
||||
makeAuthInfoBytes,
|
||||
makeSignDoc,
|
||||
Registry,
|
||||
} from "@cosmjs/proto-signing";
|
||||
import { assert, sleep } from "@cosmjs/utils";
|
||||
@ -70,15 +70,15 @@ async function sendTokens(
|
||||
},
|
||||
];
|
||||
const gasLimit = 200000;
|
||||
const authInfoBytes = makeAuthInfo([pubkey], feeAmount, gasLimit, sequence);
|
||||
const authInfoBytes = makeAuthInfoBytes([pubkey], feeAmount, gasLimit, sequence);
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const signature = await wallet.sign(walletAddress, signDocBytes);
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const signResponse = await wallet.signDirect(walletAddress, signDoc);
|
||||
const txRaw = TxRaw.create({
|
||||
bodyBytes: txBodyBytes,
|
||||
authInfoBytes: authInfoBytes,
|
||||
signatures: [fromBase64(signature.signature)],
|
||||
signatures: [fromBase64(signResponse.signature.signature)],
|
||||
});
|
||||
const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish());
|
||||
const broadcastResponse = await client.broadcastTx(txRawBytes);
|
||||
|
||||
@ -3,8 +3,9 @@ import { fromBase64, toBase64 } from "@cosmjs/encoding";
|
||||
import {
|
||||
DirectSecp256k1Wallet,
|
||||
encodePubkey,
|
||||
makeAuthInfo,
|
||||
makeAuthInfoBytes,
|
||||
makeSignBytes,
|
||||
makeSignDoc,
|
||||
Registry,
|
||||
} from "@cosmjs/proto-signing";
|
||||
import { assert, sleep } from "@cosmjs/utils";
|
||||
@ -292,15 +293,15 @@ describe("StargateClient", () => {
|
||||
},
|
||||
];
|
||||
const gasLimit = 200000;
|
||||
const authInfoBytes = makeAuthInfo([pubkey], feeAmount, gasLimit, sequence);
|
||||
const authInfoBytes = makeAuthInfoBytes([pubkey], feeAmount, gasLimit, sequence);
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const signature = await wallet.sign(address, signDocBytes);
|
||||
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
||||
const signResponse = await wallet.signDirect(address, signDoc);
|
||||
const txRaw = TxRaw.create({
|
||||
bodyBytes: txBodyBytes,
|
||||
authInfoBytes: authInfoBytes,
|
||||
signatures: [fromBase64(signature.signature)],
|
||||
signatures: [fromBase64(signResponse.signature.signature)],
|
||||
});
|
||||
const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish());
|
||||
const txResult = await client.broadcastTx(txRawBytes);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user