Skip to content

Commit 69d3172

Browse files
committed
Apply updates from core
1 parent d4e636d commit 69d3172

File tree

9 files changed

+139
-165
lines changed

9 files changed

+139
-165
lines changed

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@initia/initia.js",
3-
"version": "0.2.28",
3+
"version": "0.2.29",
44
"description": "The JavaScript SDK for Initia",
55
"license": "Apache-2.0",
66
"author": "Initia Foundation",
@@ -57,7 +57,7 @@
5757
},
5858
"dependencies": {
5959
"@bitcoinerlab/secp256k1": "^1.1.1",
60-
"@initia/initia.proto": "^0.2.5",
60+
"@initia/initia.proto": "^0.2.6",
6161
"@initia/opinit.proto": "^0.0.11",
6262
"@ledgerhq/hw-transport": "^6.31.4",
6363
"@ledgerhq/hw-transport-webhid": "^6.29.4",

src/client/rest/api/MarketmapAPI.ts

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ export class MarketmapAPI extends BaseAPI {
3030
})
3131
}
3232

33+
/**
34+
* Query all stored markets in the marketmap module as a sorted list.
35+
*/
36+
public async markets(params: APIParams = {}): Promise<Market[]> {
37+
return this.c
38+
.get<{ markets: Market.Data[] }>(`/connect/marketmap/v2/markets`, params)
39+
.then((d) => d.markets.map(Market.fromData))
40+
}
41+
3342
/**
3443
* Query the market stored in the marketmap module.
3544
* @param pair the currency pair associated with the market being requested

src/core/Msg.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ import {
131131
MsgCreateMarkets,
132132
MsgUpdateMarkets,
133133
MsgUpsertMarkets,
134+
MsgRemoveMarkets,
134135
MsgRemoveMarketAuthorities,
135136
MsgUpdateMarketmapParams,
136137
} from './marketmap/msgs'
@@ -202,7 +203,6 @@ import {
202203
MsgChangeAdmin,
203204
MsgSetDenomMetadataWasm,
204205
MsgSetBeforeSendHook,
205-
MsgForceTransfer,
206206
MsgUpdateTokenfactoryParams,
207207
} from './tokenfactory'
208208
import { UpgradeMsg, MsgSoftwareUpgrade, MsgCancelUpgrade } from './upgrade'
@@ -537,6 +537,8 @@ export namespace Msg {
537537
return MsgUpdateMarkets.fromAmino(data)
538538
case 'connect/x/marketmap/MsgUpsertMarkets':
539539
return MsgUpsertMarkets.fromAmino(data)
540+
case 'connect/x/marketmap/MsgRemoveMarkets':
541+
return MsgRemoveMarkets.fromAmino(data)
540542
case 'connect/x/marketmap/MsgRemoveMarketAuthorities':
541543
return MsgRemoveMarketAuthorities.fromAmino(data)
542544
case 'connect/x/marketmap/MsgParams':
@@ -661,8 +663,6 @@ export namespace Msg {
661663
return MsgSetDenomMetadataWasm.fromAmino(data)
662664
case 'tokenfactory/MsgSetBeforeSendHook':
663665
return MsgSetBeforeSendHook.fromAmino(data)
664-
case 'tokenfactory/MsgForceTransfer':
665-
return MsgForceTransfer.fromAmino(data)
666666
case 'tokenfactory/MsgUpdateParams':
667667
return MsgUpdateTokenfactoryParams.fromAmino(data)
668668

@@ -947,6 +947,8 @@ export namespace Msg {
947947
return MsgUpdateMarkets.fromData(data)
948948
case '/connect.marketmap.v2.MsgUpsertMarkets':
949949
return MsgUpsertMarkets.fromData(data)
950+
case '/connect.marketmap.v2.MsgRemoveMarkets':
951+
return MsgRemoveMarkets.fromData(data)
950952
case '/connect.marketmap.v2.MsgRemoveMarketAuthorities':
951953
return MsgRemoveMarketAuthorities.fromData(data)
952954
case '/connect.marketmap.v2.MsgParams':
@@ -1071,8 +1073,6 @@ export namespace Msg {
10711073
return MsgSetDenomMetadataWasm.fromData(data)
10721074
case '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook':
10731075
return MsgSetBeforeSendHook.fromData(data)
1074-
case '/miniwasm.tokenfactory.v1.MsgForceTransfer':
1075-
return MsgForceTransfer.fromData(data)
10761076
case '/miniwasm.tokenfactory.v1.MsgUpdateParams':
10771077
return MsgUpdateTokenfactoryParams.fromData(data)
10781078

@@ -1357,6 +1357,8 @@ export namespace Msg {
13571357
return MsgUpdateMarkets.unpackAny(proto)
13581358
case '/connect.marketmap.v2.MsgUpsertMarkets':
13591359
return MsgUpsertMarkets.unpackAny(proto)
1360+
case '/connect.marketmap.v2.MsgRemoveMarkets':
1361+
return MsgRemoveMarkets.unpackAny(proto)
13601362
case '/connect.marketmap.v2.MsgRemoveMarketAuthorities':
13611363
return MsgRemoveMarketAuthorities.unpackAny(proto)
13621364
case '/connect.marketmap.v2.MsgParams':
@@ -1481,8 +1483,6 @@ export namespace Msg {
14811483
return MsgSetDenomMetadataWasm.unpackAny(proto)
14821484
case '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook':
14831485
return MsgSetBeforeSendHook.unpackAny(proto)
1484-
case '/miniwasm.tokenfactory.v1.MsgForceTransfer':
1485-
return MsgForceTransfer.unpackAny(proto)
14861486
case '/miniwasm.tokenfactory.v1.MsgUpdateParams':
14871487
return MsgUpdateTokenfactoryParams.unpackAny(proto)
14881488

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import { JSONSerializable } from '../../../util/json'
2+
import { AccAddress } from '../../bech32'
3+
import { Any } from '@initia/initia.proto/google/protobuf/any'
4+
import { MsgRemoveMarkets as MsgRemoveMarkets_pb } from '@initia/initia.proto/connect/marketmap/v2/tx'
5+
import { Market } from '../Market'
6+
7+
/**
8+
* MsgRemoveMarkets removes the given markets from the marketmap if they exist in the map and if they are disabled.
9+
*/
10+
export class MsgRemoveMarkets extends JSONSerializable<
11+
MsgRemoveMarkets.Amino,
12+
MsgRemoveMarkets.Data,
13+
MsgRemoveMarkets.Proto
14+
> {
15+
/**
16+
* @param authority the signer of this transaction
17+
* @param markets the list of markets to remove
18+
*/
19+
constructor(
20+
public authority: AccAddress,
21+
public markets: string[]
22+
) {
23+
super()
24+
}
25+
26+
public static fromAmino(data: MsgRemoveMarkets.Amino): MsgRemoveMarkets {
27+
const {
28+
value: { authority, markets },
29+
} = data
30+
return new MsgRemoveMarkets(authority, markets)
31+
}
32+
33+
public toAmino(): MsgRemoveMarkets.Amino {
34+
const { authority, markets } = this
35+
return {
36+
type: 'connect/x/marketmap/MsgRemoveMarkets',
37+
value: {
38+
authority,
39+
markets,
40+
},
41+
}
42+
}
43+
44+
public static fromData(data: MsgRemoveMarkets.Data): MsgRemoveMarkets {
45+
const { authority, markets } = data
46+
return new MsgRemoveMarkets(authority, markets)
47+
}
48+
49+
public toData(): MsgRemoveMarkets.Data {
50+
const { authority, markets } = this
51+
return {
52+
'@type': '/connect.marketmap.v2.MsgRemoveMarkets',
53+
authority,
54+
markets,
55+
}
56+
}
57+
58+
public static fromProto(data: MsgRemoveMarkets.Proto): MsgRemoveMarkets {
59+
return new MsgRemoveMarkets(
60+
data.authority,
61+
data.markets
62+
)
63+
}
64+
65+
public toProto(): MsgRemoveMarkets.Proto {
66+
const { authority, markets } = this
67+
return MsgRemoveMarkets_pb.fromPartial({
68+
authority,
69+
markets,
70+
})
71+
}
72+
73+
public packAny(): Any {
74+
return Any.fromPartial({
75+
typeUrl: '/connect.marketmap.v2.MsgRemoveMarkets',
76+
value: MsgRemoveMarkets_pb.encode(this.toProto()).finish(),
77+
})
78+
}
79+
80+
public static unpackAny(msgAny: Any): MsgRemoveMarkets {
81+
return MsgRemoveMarkets.fromProto(MsgRemoveMarkets_pb.decode(msgAny.value))
82+
}
83+
}
84+
85+
export namespace MsgRemoveMarkets {
86+
export interface Amino {
87+
type: 'connect/x/marketmap/MsgRemoveMarkets'
88+
value: {
89+
authority: AccAddress
90+
markets: string[]
91+
}
92+
}
93+
94+
export interface Data {
95+
'@type': '/connect.marketmap.v2.MsgRemoveMarkets'
96+
authority: AccAddress
97+
markets: string[]
98+
}
99+
100+
export type Proto = MsgRemoveMarkets_pb
101+
}

src/core/marketmap/msgs/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import { MsgCreateMarkets } from './MsgCreateMarkets'
22
import { MsgUpdateMarkets } from './MsgUpdateMarkets'
33
import { MsgUpsertMarkets } from './MsgUpsertMarkets'
4+
import { MsgRemoveMarkets } from './MsgRemoveMarkets'
45
import { MsgRemoveMarketAuthorities } from './MsgRemoveMarketAuthorities'
56
import { MsgUpdateMarketmapParams } from './MsgUpdateMarketmapParams'
67

78
export * from './MsgCreateMarkets'
89
export * from './MsgUpdateMarkets'
910
export * from './MsgUpsertMarkets'
11+
export * from './MsgRemoveMarkets'
1012
export * from './MsgRemoveMarketAuthorities'
1113
export * from './MsgUpdateMarketmapParams'
1214

1315
export type MarketmapMsg =
1416
| MsgCreateMarkets
1517
| MsgUpdateMarkets
1618
| MsgUpsertMarkets
19+
| MsgRemoveMarkets
1720
| MsgRemoveMarketAuthorities
1821
| MsgUpdateMarketmapParams
1922

@@ -22,20 +25,23 @@ export namespace MarketmapMsg {
2225
| MsgCreateMarkets.Amino
2326
| MsgUpdateMarkets.Amino
2427
| MsgUpsertMarkets.Amino
28+
| MsgRemoveMarkets.Amino
2529
| MsgRemoveMarketAuthorities.Amino
2630
| MsgUpdateMarketmapParams.Amino
2731

2832
export type Data =
2933
| MsgCreateMarkets.Data
3034
| MsgUpdateMarkets.Data
3135
| MsgUpsertMarkets.Data
36+
| MsgRemoveMarkets.Data
3237
| MsgRemoveMarketAuthorities.Data
3338
| MsgUpdateMarketmapParams.Data
3439

3540
export type Proto =
3641
| MsgCreateMarkets.Proto
3742
| MsgUpdateMarkets.Proto
3843
| MsgUpsertMarkets.Proto
44+
| MsgRemoveMarkets.Proto
3945
| MsgRemoveMarketAuthorities.Proto
4046
| MsgUpdateMarketmapParams.Proto
4147
}

src/core/tokenfactory/msgs/MsgBurn.ts

+8-16
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,59 @@ export class MsgBurn extends JSONSerializable<
1717
/**
1818
* @param sender
1919
* @param amount
20-
* @param burn_from_address
2120
*/
2221
constructor(
2322
public sender: AccAddress,
2423
public amount: Coin,
25-
public burn_from_address: AccAddress
2624
) {
2725
super()
2826
}
2927

3028
public static fromAmino(data: MsgBurn.Amino): MsgBurn {
3129
const {
32-
value: { sender, amount, burn_from_address },
30+
value: { sender, amount },
3331
} = data
3432

35-
return new MsgBurn(sender, Coin.fromAmino(amount), burn_from_address)
33+
return new MsgBurn(sender, Coin.fromAmino(amount))
3634
}
3735

3836
public toAmino(): MsgBurn.Amino {
39-
const { sender, amount, burn_from_address } = this
37+
const { sender, amount } = this
4038
return {
4139
type: 'tokenfactory/MsgBurn',
4240
value: {
4341
sender,
4442
amount: amount.toAmino(),
45-
burn_from_address,
4643
},
4744
}
4845
}
4946

5047
public static fromData(data: MsgBurn.Data): MsgBurn {
51-
const { sender, amount, burn_from_address } = data
52-
return new MsgBurn(sender, Coin.fromData(amount), burn_from_address)
48+
const { sender, amount } = data
49+
return new MsgBurn(sender, Coin.fromData(amount))
5350
}
5451

5552
public toData(): MsgBurn.Data {
56-
const { sender, amount, burn_from_address } = this
53+
const { sender, amount } = this
5754
return {
5855
'@type': '/miniwasm.tokenfactory.v1.MsgBurn',
5956
sender,
6057
amount: amount.toData(),
61-
burn_from_address,
6258
}
6359
}
6460

6561
public static fromProto(data: MsgBurn.Proto): MsgBurn {
6662
return new MsgBurn(
6763
data.sender,
68-
Coin.fromProto(data.amount as Coin.Proto),
69-
data.burnFromAddress
64+
Coin.fromProto(data.amount as Coin.Proto)
7065
)
7166
}
7267

7368
public toProto(): MsgBurn.Proto {
74-
const { sender, amount, burn_from_address } = this
69+
const { sender, amount } = this
7570
return MsgBurn_pb.fromPartial({
7671
sender,
7772
amount: amount.toProto(),
78-
burnFromAddress: burn_from_address,
7973
})
8074
}
8175

@@ -97,15 +91,13 @@ export namespace MsgBurn {
9791
value: {
9892
sender: AccAddress
9993
amount: Coin.Amino
100-
burn_from_address: AccAddress
10194
}
10295
}
10396

10497
export interface Data {
10598
'@type': '/miniwasm.tokenfactory.v1.MsgBurn'
10699
sender: AccAddress
107100
amount: Coin.Data
108-
burn_from_address: AccAddress
109101
}
110102

111103
export type Proto = MsgBurn_pb

0 commit comments

Comments
 (0)