Skip to content

Commit 8e6467a

Browse files
committed
chore: msgFundCommunityPool add support to accept singular coin payload (object and array)
1 parent 7dd92db commit 8e6467a

File tree

5 files changed

+3157
-8906
lines changed

5 files changed

+3157
-8906
lines changed

packages/sdk-ts/src/core/modules/bank/msgs/MsgSend.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import * as CosmosBankV1Beta1TxPb from '@injectivelabs/core-proto-ts-v2/generated/cosmos/bank/v1beta1/tx_pb'
22
import * as CosmosBaseV1Beta1CoinPb from '@injectivelabs/core-proto-ts-v2/generated/cosmos/base/v1beta1/coin_pb'
33
import { MsgBase } from '../../MsgBase.js'
4+
import type { Coin } from '@injectivelabs/ts-types'
45

56
export declare namespace MsgSend {
67
export interface Params {
7-
amount:
8-
| {
9-
denom: string
10-
amount: string
11-
}
12-
| {
13-
denom: string
14-
amount: string
8+
amount: Coin | Coin[]
9+
srcInjectiveAddress: string
10+
dstInjectiveAddress: string
11+
}
12+
13+
export type Proto = CosmosBankV1Beta1TxPb.MsgSend
14+
}
15+
16+
/**
17+
* @category Messages
1518
}[]
1619
srcInjectiveAddress: string
1720
dstInjectiveAddress: string

packages/sdk-ts/src/core/modules/distribution/msgs/MsgFundCommunityPool.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { TypedDataField } from '../../../tx/eip712/types.js'
66

77
export declare namespace MsgFundCommunityPool {
88
export interface Params {
9-
amount: Coin[]
9+
amount: Coin | Coin[]
1010
depositor: string
1111
}
1212

@@ -27,7 +27,11 @@ export default class MsgFundCommunityPool extends MsgBase<
2727
public toProto() {
2828
const { params } = this
2929

30-
const coins = params.amount.map((amount) => {
30+
const amounts = Array.isArray(params.amount)
31+
? params.amount
32+
: [params.amount]
33+
34+
const coins = amounts.map((amount) => {
3135
return CosmosBaseV1Beta1CoinPb.Coin.create({
3236
denom: amount.denom,
3337
amount: amount.amount,

packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContract.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@ import * as CosmosBaseV1Beta1CoinPb from '@injectivelabs/core-proto-ts-v2/genera
44
import { MsgBase } from '../../MsgBase.js'
55
import { fromUtf8 } from '../../../../utils/encoding.js'
66
import { safeBigIntStringify } from '../../../../utils/helpers.js'
7+
import type { Coin } from '@injectivelabs/ts-types'
78
import type { ExecArgs } from '../exec-args.js'
89

910
export declare namespace MsgExecuteContract {
1011
export interface Params {
1112
/* Keep in mind that funds have to be lexicographically sorted by denom */
12-
funds?:
13-
| {
14-
denom: string
15-
amount: string
16-
}
17-
| {
18-
denom: string
19-
amount: string
20-
}[]
13+
funds?: Coin | Coin[]
2114
sender: string
2215
contractAddress: string
2316
/* Used to provide type safety for execution messages */

packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContractCompat.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@ import { GeneralException } from '@injectivelabs/exceptions'
22
import * as InjectiveWasmxV1TxPb from '@injectivelabs/core-proto-ts-v2/generated/injective/wasmx/v1/tx_pb'
33
import { MsgBase } from '../../MsgBase.js'
44
import { safeBigIntStringify } from '../../../../utils/helpers.js'
5+
import type { Coin } from '@injectivelabs/ts-types'
56
import type { ExecArgs } from '../exec-args.js'
67

78
export declare namespace MsgExecuteContractCompat {
89
export interface Params {
910
/* Keep in mind that funds have to be lexicographically sorted by denom */
10-
funds?:
11-
| {
12-
denom: string
13-
amount: string
14-
}
15-
| {
16-
denom: string
17-
amount: string
18-
}[]
11+
funds?: Coin | Coin[]
1912
sender: string
2013
contractAddress: string
2114

0 commit comments

Comments
 (0)