-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiSend example #2
Comments
other examples that have simple flow https://gist.github.com/fadeev/a4981eff1cf3a805ef10e25313d5f2b7 |
Here is the original index that impelled us to customize the signing client: const { config } = require('./config/config.js');
const { generateSignerWallet } = require('./signer.js');
const {
osmosis,
ibc,
cosmos,
getSigningOsmosisClient,
signAndBroadcast,
FEE_VALUES
} = require('osmojs');
const { coin, coins } = require('@cosmjs/amino');
const {
multiSend,
send
} = cosmos.bank.v1beta1.MessageComposer.fromPartial;
/* TEST */
const amount = coins(1, 'uosmo');
const fee = FEE_VALUES.osmosis.swapExactAmountIn;
(async () => {
const signer = await generateSignerWallet("osmosis", config.mnemonic).then((signer) => { return signer; });
const address = await signer.getAccounts().then((accounts) => { return accounts[0].address; });
const rpcEndpoint = config.rpcEndpoint;
const client = await getSigningOsmosisClient({ rpcEndpoint, signer });
const msg = send({
fromAddress: address,
toAddress: "osmo1REDACTED",
amount: amount
});
console.dir(msg, { depth: null });
/*
prints the following:
{
typeUrl: '/cosmos.bank.v1beta1.MsgSend',
value: {
fromAddress: 'osmo1REDACTED',
toAddress: 'osmo1osmo1REDACTED',
amount: [ { denom: 'uosmo', amount: '1' } ]
}
}
*/
const res = await signAndBroadcast({
client,
chainId: 'osmosis-1',
address: address,
msgs: [msg],
fee,
memo: config.default_memo
});
/*
nodejs crashes with error:
C:\dev\user\test\node_modules\@cosmjs\stargate\build\aminotypes.js:21
throw new Error(`Type URL '${typeUrl}' does not exist in the Amino message type register. ` +
^
Error: Type URL '/cosmos.bank.v1beta1.MsgSend' does not exist in the Amino message type register. If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.
at AminoTypes.toAmino (C:\dev\user\test\node_modules\@cosmjs\stargate\build\aminotypes.js:21:19)
at C:\dev\user\test\node_modules\@cosmjs\stargate\build\signingstargateclient.js:207:60
at Array.map (<anonymous>)
at SigningStargateClient.signAmino (C:\dev\user\test\node_modules\@cosmjs\stargate\build\signingstargateclient.js:207:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
*/
console.log(res);
})(); |
I'm actually proposing we make multi-send only allow one sender haha: cosmos/cosmos-sdk#12601 |
pyramation
added a commit
that referenced
this issue
Aug 2, 2023
fix type incompatible problem caused by bigint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we may also need to do something special with the signingCosmosClient to make this easier:
an example from the community:
The text was updated successfully, but these errors were encountered: