Skip to content

Commit

Permalink
feat: handle async messages
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseRFelix committed Aug 12, 2024
1 parent 4593983 commit effc632
Show file tree
Hide file tree
Showing 27 changed files with 251 additions and 156 deletions.
2 changes: 1 addition & 1 deletion packages/bridge/src/axelar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export class AxelarBridgeProvider implements BridgeProvider {
);
}

const { typeUrl, value: msg } = makeIBCTransferMsg({
const { typeUrl, value: msg } = await makeIBCTransferMsg({
receiver: depositAddress,
sender: fromAddress,
sourceChannel: ibcTransferMethod.chain.channelId,
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/src/ibc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class IbcBridgeProvider implements BridgeProvider {
chainId: params.toChain.chainId.toString(),
});

const { typeUrl, value: msg } = makeIBCTransferMsg({
const { typeUrl, value: msg } = await makeIBCTransferMsg({
receiver: params.toAddress,
sender: params.fromAddress,
sourceChannel,
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge/src/skip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export class SkipBridgeProvider implements BridgeProvider {
}[];
};

const { typeUrl, value: msg } = makeExecuteCosmwasmContractMsg({
const { typeUrl, value: msg } = await makeExecuteCosmwasmContractMsg({
sender: cosmwasmData.sender,
contract: cosmwasmData.contract,
msg: Buffer.from(JSON.stringify(cosmwasmData.msg)),
Expand All @@ -510,7 +510,7 @@ export class SkipBridgeProvider implements BridgeProvider {
: { destinationAddress: messageData.receiver }
);

const { typeUrl, value } = makeIBCTransferMsg({
const { typeUrl, value } = await makeIBCTransferMsg({
sourcePort: messageData.source_port,
sourceChannel: messageData.source_channel,
token: {
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge/src/squid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export class SquidBridgeProvider implements BridgeProvider {
: { destinationAddress: ibcData.msg.receiver }
);

const { typeUrl, value: msg } = makeIBCTransferMsg({
const { typeUrl, value: msg } = await makeIBCTransferMsg({
memo: ibcData.msg.memo,
receiver: ibcData.msg.receiver,
sender: ibcData.msg.sender,
Expand Down Expand Up @@ -578,7 +578,7 @@ export class SquidBridgeProvider implements BridgeProvider {
};
};

const { typeUrl, value: msg } = makeExecuteCosmwasmContractMsg({
const { typeUrl, value: msg } = await makeExecuteCosmwasmContractMsg({
sender: fromAddress,
contract: cosmwasmData.msg.wasm.contract,
msg: Buffer.from(JSON.stringify(cosmwasmData.msg.wasm.msg)),
Expand Down
2 changes: 1 addition & 1 deletion packages/stores/src/account/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class CosmosAccountImpl {
destinationInfo.network
).version.toString();

const msg = makeIBCTransferMsg({
const msg = await makeIBCTransferMsg({
sourcePort: channel.portId,
sourceChannel: channel.channelId,
token: {
Expand Down
20 changes: 11 additions & 9 deletions packages/stores/src/account/cosmwasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class CosmwasmAccountImpl {
onFulfill?: (tx: DeliverTxResponse) => void;
}
) {
const msg = makeExecuteCosmwasmContractMsg({
const msg = await makeExecuteCosmwasmContractMsg({
sender: this.address,
contract: contractAddress,
msg: obj,
Expand Down Expand Up @@ -117,14 +117,16 @@ export class CosmwasmAccountImpl {
onFulfill?: (tx: DeliverTxResponse) => void;
}
) {
const mappedMsgs = msgs.map(({ msg, funds, contractAddress }) => {
return makeExecuteCosmwasmContractMsg({
sender: this.address,
contract: contractAddress,
msg,
funds,
});
});
const mappedMsgs = await Promise.all(
msgs.map(async ({ msg, funds, contractAddress }) => {
return await makeExecuteCosmwasmContractMsg({
sender: this.address,
contract: contractAddress,
msg,
funds,
});
})
);

await this.base.signAndBroadcast(
this.chainId,
Expand Down
Loading

0 comments on commit effc632

Please sign in to comment.