From 04e6c2b6baaf1955e17cee81d08ce1b66e5910d5 Mon Sep 17 00:00:00 2001 From: freeelancer Date: Thu, 11 Jan 2024 16:13:23 +0800 Subject: [PATCH] removed all reference to jax --- src/core/Msg.ts | 28 ---- src/core/index.ts | 4 - src/core/jax/msgs/MsgExecuteContract.ts | 177 ------------------------ src/core/jax/msgs/MsgStoreCode.ts | 154 --------------------- src/core/jax/msgs/index.ts | 16 --- 5 files changed, 379 deletions(-) delete mode 100644 src/core/jax/msgs/MsgExecuteContract.ts delete mode 100644 src/core/jax/msgs/MsgStoreCode.ts delete mode 100644 src/core/jax/msgs/index.ts diff --git a/src/core/Msg.ts b/src/core/Msg.ts index 46a1af1e..c059ac10 100644 --- a/src/core/Msg.ts +++ b/src/core/Msg.ts @@ -77,7 +77,6 @@ import { MsgSetBeforeSendHook, TokenFactoryMsg, } from './tokenfactory'; -import { JAXMsgExecuteContract, JAXMsgStoreCode, JaxMsg } from './jax/msgs'; import { MsgTransfer, IbcTransferMsg } from './ibc/applications/transfer'; import { MsgCreateClient, @@ -142,7 +141,6 @@ export type Msg = | AllianceMsg | CustomMsg | CrisisMsg - | JaxMsg | MsgAuctionBid | FeeshareMsg | TokenFactoryMsg; @@ -163,7 +161,6 @@ export namespace Msg { | AllianceMsg.Amino | CustomMsg.Amino | CrisisMsg.Amino - | JaxMsg.Amino | MsgAuctionBid.Amino | FeeshareMsg.Amino | TokenFactoryMsg.Amino; @@ -187,7 +184,6 @@ export namespace Msg { | AllianceMsg.Data | CustomMsg.Data | CrisisMsg.Data - | JaxMsg.Data | MsgAuctionBid.Data | FeeshareMsg.Data | TokenFactoryMsg.Data; @@ -210,7 +206,6 @@ export namespace Msg { | IbcChannelMsg.Proto | AllianceMsg.Proto | CrisisMsg.Proto - | JaxMsg.Proto | MsgAuctionBid.Proto | FeeshareMsg.Proto | TokenFactoryMsg.Proto; @@ -484,17 +479,6 @@ export namespace Msg { data as MsgVerifyInvariant.Amino, isClassic ); - // jax - case 'jax/MsgExecuteContract': - return JAXMsgExecuteContract.fromAmino( - data as JAXMsgExecuteContract.Amino, - isClassic - ); - case 'jax/MsgStoreCode': - return JAXMsgStoreCode.fromAmino( - data as JAXMsgStoreCode.Amino, - isClassic - ); // Pob module case 'pob/MsgAuctionBid': @@ -707,12 +691,6 @@ export namespace Msg { case '/cosmos.crisis.v1beta1.MsgVerifyInvariant': return MsgVerifyInvariant.fromData(data, isClassic); - // jax - case '/jax.MsgExecuteContract': - return JAXMsgExecuteContract.fromData(data, isClassic); - case '/jax.MsgStoreCode': - return JAXMsgStoreCode.fromData(data, isClassic); - // pob module case '/pob.builder.v1.MsgAuctionBid': return MsgAuctionBid.fromData(data, isClassic); @@ -919,12 +897,6 @@ export namespace Msg { case '/cosmos.crisis.v1beta1.MsgVerifyInvariant': return MsgVerifyInvariant.unpackAny(proto, isClassic); - // jax - case '/jax.MsgExecuteContract': - return JAXMsgExecuteContract.unpackAny(proto, isClassic); - case '/jax.MsgStoreCode': - return JAXMsgStoreCode.unpackAny(proto, isClassic); - case '/pob.builder.v1.MsgAuctionBid': return MsgAuctionBid.unpackAny(proto, isClassic); diff --git a/src/core/index.ts b/src/core/index.ts index 08ab4cf5..8fdf9063 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -24,10 +24,6 @@ export { MsgRedelegate as MsgAllianceRedelegate } from './alliance/msgs/MsgRedel export { MsgClaimDelegationRewards as MsgClaimDelegationRewards } from './alliance/msgs/MsgClaimDelegationRewards'; export * from './alliance/proposals'; -// JAX -export { MsgExecuteContract as JAXMsgExecuteContract } from './jax/msgs/MsgExecuteContract'; -export { MsgStoreCode as JAXMsgStoreCode } from './jax/msgs/MsgStoreCode'; - // Auth export * from './auth/Account'; export * from './auth/BaseAccount'; diff --git a/src/core/jax/msgs/MsgExecuteContract.ts b/src/core/jax/msgs/MsgExecuteContract.ts deleted file mode 100644 index dd67f726..00000000 --- a/src/core/jax/msgs/MsgExecuteContract.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { JSONSerializable, removeNull } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coins } from '../../Coins'; -import { Any } from '@terra-money/terra.proto/google/protobuf/any'; -import { MsgExecuteContract as MsgExecuteContract_pb } from '@terra-money/terra.proto/jax/tx'; - -export class MsgExecuteContract extends JSONSerializable< - MsgExecuteContract.Amino, - MsgExecuteContract.Data, - MsgExecuteContract.Proto -> { - public coins: Coins; - - /** - * @param sender contract user - * @param contract contract address - * @param method method name on the contract - * @param params json stringified params - * @param coins coins to be sent to contract - */ - constructor( - public sender: AccAddress, - public contract: AccAddress, - public method: string, - public params: string, - coins: Coins.Input = {} - ) { - super(); - this.coins = new Coins(coins); - } - - public static fromAmino( - data: MsgExecuteContract.Amino, - _?: boolean - ): MsgExecuteContract { - const { - value: { sender, contract, method, params, coins }, - } = data as MsgExecuteContract.AminoV2; - return new MsgExecuteContract( - sender, - contract, - method, - params, - Coins.fromAmino(coins) - ); - } - - public toAmino(_?: boolean): MsgExecuteContract.Amino { - const { sender, contract, method, params, coins } = this; - return { - type: 'jax/MsgExecuteContract', - value: { - sender, - contract, - method, - params, - coins: coins.toAmino(), - }, - }; - } - - public static fromProto( - proto: MsgExecuteContract.Proto, - _?: boolean - ): MsgExecuteContract { - const p = proto as MsgExecuteContract_pb; - return new MsgExecuteContract( - p.sender, - p.contract, - p.method, - p.params, - Coins.fromProto(p.coins) - ); - } - - public toProto(_?: boolean): MsgExecuteContract.Proto { - const { sender, contract, method, params, coins } = this; - return MsgExecuteContract_pb.fromPartial({ - coins: coins.toProto(), - contract, - sender, - method, - params, - }); - } - - public packAny(isClassic?: boolean): Any { - return Any.fromPartial({ - typeUrl: '/jax.MsgExecuteContract', - value: MsgExecuteContract_pb.encode( - this.toProto(isClassic) as MsgExecuteContract_pb - ).finish(), - }); - } - - public static unpackAny( - msgAny: Any, - isClassic?: boolean - ): MsgExecuteContract { - return MsgExecuteContract.fromProto( - MsgExecuteContract_pb.decode(msgAny.value), - isClassic - ); - } - - public static fromData( - data: MsgExecuteContract.Data, - _?: boolean - ): MsgExecuteContract { - const { sender, contract, method, params, coins } = - data as MsgExecuteContract.DataV2; - return new MsgExecuteContract( - sender, - contract, - method, - params, - Coins.fromData(coins) - ); - } - - public toData(_?: boolean): MsgExecuteContract.Data { - const { sender, contract, method, params, coins } = this; - return { - '@type': '/jax.MsgExecuteContract', - sender, - contract, - method, - params, - coins: coins.toData(), - }; - } -} - -export namespace MsgExecuteContract { - export interface AminoV1 { - type: 'jax/MsgExecuteContract'; - value: { - sender: AccAddress; - contract: AccAddress; - method: string; - params: string; - coins: Coins.Amino; - }; - } - - export interface AminoV2 { - type: 'jax/MsgExecuteContract'; - value: { - sender: AccAddress; - contract: AccAddress; - method: string; - params: string; - coins: Coins.Amino; - }; - } - - export interface DataV1 { - '@type': '/jax.MsgExecuteContract'; - sender: AccAddress; - contract: AccAddress; - method: string; - params: string; - coins: Coins.Data; - } - export interface DataV2 { - '@type': '/jax.MsgExecuteContract'; - sender: AccAddress; - contract: AccAddress; - method: string; - params: string; - coins: Coins.Data; - } - - export type Amino = AminoV1 | AminoV2; - export type Data = DataV1 | DataV2; - export type Proto = MsgExecuteContract_pb; -} diff --git a/src/core/jax/msgs/MsgStoreCode.ts b/src/core/jax/msgs/MsgStoreCode.ts deleted file mode 100644 index 841a9fe1..00000000 --- a/src/core/jax/msgs/MsgStoreCode.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coins } from '../../Coins'; -import { Any } from '@terra-money/terra.proto/google/protobuf/any'; -import { MsgStoreCode as MsgStoreCode_pb } from '@terra-money/terra.proto/jax/tx'; - -export class MsgStoreCode extends JSONSerializable< - MsgStoreCode.Amino, - MsgStoreCode.Data, - MsgStoreCode.Proto -> { - public coins: Coins; - /** - * @param creator contract deployer - * @param admin address of contract admin, usually contract deployer - * @param code the JavaScript source code of the contract - * @param params json stringified params to pass to init - * @param coins coins to be sent to contract - */ - constructor( - public creator: AccAddress, - public admin: AccAddress, - public code: string, - public params: string, - coins: Coins.Input = {} - ) { - super(); - this.coins = new Coins(coins); - } - - public static fromAmino(data: MsgStoreCode.Amino, _?: boolean): MsgStoreCode { - const { - value: { creator, admin, code, params }, - } = data as MsgStoreCode.AminoV2; - return new MsgStoreCode(creator, admin, code, params); - } - - public toAmino(_?: boolean): MsgStoreCode.Amino { - const { creator, admin, code, params, coins } = this; - return { - type: 'jax/MsgStoreCode', - value: { - creator, - admin, - code, - params, - coins: coins.toAmino(), - }, - }; - } - - public static fromProto( - proto: MsgStoreCode.Proto, - _?: boolean - ): MsgStoreCode { - const p = proto as MsgStoreCode_pb; - return new MsgStoreCode(p.creator, p.admin, p.code, p.params); - } - - public toProto(_?: boolean): MsgStoreCode.Proto { - const { creator, admin, code, params, coins } = this; - return MsgStoreCode_pb.fromPartial({ - creator, - admin, - code, - params, - coins: coins.toProto(), - }); - } - - public packAny(isClassic?: boolean): Any { - return Any.fromPartial({ - typeUrl: '/jax.MsgStoreCode', - value: MsgStoreCode_pb.encode( - this.toProto(isClassic) as MsgStoreCode_pb - ).finish(), - }); - } - - public static unpackAny(msgAny: Any, isClassic?: boolean): MsgStoreCode { - return MsgStoreCode.fromProto( - MsgStoreCode_pb.decode(msgAny.value), - isClassic - ); - } - - public static fromData(data: MsgStoreCode.Data, _?: boolean): MsgStoreCode { - const { creator, admin, code, params, coins } = data as MsgStoreCode.DataV2; - return new MsgStoreCode( - creator, - admin, - code, - params, - Coins.fromData(coins) - ); - } - - public toData(_?: boolean): MsgStoreCode.Data { - const { creator, admin, code, params, coins } = this; - return { - '@type': '/jax.MsgStoreCode', - creator, - admin, - code, - params, - coins: coins.toData(), - }; - } -} - -export namespace MsgStoreCode { - export interface AminoV1 { - type: 'jax/MsgStoreCode'; - value: { - creator: AccAddress; - admin: AccAddress; - code: string; - params: string; - coins: Coins.Amino; - }; - } - - export interface AminoV2 { - type: 'jax/MsgStoreCode'; - value: { - creator: AccAddress; - admin: AccAddress; - code: string; - params: string; - coins: Coins.Amino; - }; - } - - export interface DataV1 { - '@type': '/jax.MsgStoreCode'; - creator: AccAddress; - admin: AccAddress; - code: string; - params: string; - coins: Coins.Data; - } - export interface DataV2 { - '@type': '/jax.MsgStoreCode'; - creator: AccAddress; - admin: AccAddress; - code: string; - params: string; - coins: Coins.Data; - } - - export type Amino = AminoV1 | AminoV2; - export type Data = DataV1 | DataV2; - export type Proto = MsgStoreCode_pb; -} diff --git a/src/core/jax/msgs/index.ts b/src/core/jax/msgs/index.ts deleted file mode 100644 index e81c4ab4..00000000 --- a/src/core/jax/msgs/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MsgExecuteContract } from './MsgExecuteContract'; -import { MsgStoreCode } from './MsgStoreCode'; - -// These messages are similar to the wasm module so prefix with JAX. -export { MsgExecuteContract as JAXMsgExecuteContract }; -export { MsgStoreCode as JAXMsgStoreCode }; - -export type JaxMsg = MsgExecuteContract | MsgStoreCode; - -export namespace JaxMsg { - export type Data = MsgExecuteContract.Data | MsgStoreCode.Data; - - export type Amino = MsgExecuteContract.Amino | MsgStoreCode.Amino; - - export type Proto = MsgExecuteContract.Proto | MsgStoreCode.Proto; -}