-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add is group token check * Add USD check * Update codecs and group token functions * Update codecs * Add convert to group function * Remove hardcoded addresses inside example scripts * v0.3.37-dev.1+322bc50eaadc * Update codecs * Add group admin rpc, remove comments and logs * Add AminoTypes * Fix Amino types * v0.3.37-dev.2+18512988ac7f --------- Co-authored-by: sarah-thong <[email protected]>
- Loading branch information
1 parent
15b1459
commit c011216
Showing
21 changed files
with
3,997 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as BIP39 from "bip39"; | ||
import { MsgWithdrawFromGroup } from "../lib/codec"; | ||
import { CarbonSDK, CarbonTx } from "./_sdk"; | ||
import "./_setup"; | ||
|
||
(async () => { | ||
const mnemonics = process.env.MNEMONICS ?? BIP39.generateMnemonic(); | ||
console.log("mnemonics", mnemonics); | ||
|
||
const sdk = await CarbonSDK.instanceWithMnemonic(mnemonics, { network: CarbonSDK.Network.LocalHost}); | ||
|
||
const result = await sdk.wallet.sendTxs([{ | ||
typeUrl: CarbonTx.Types.MsgWithdrawFromGroup, | ||
value: MsgWithdrawFromGroup.fromPartial({ | ||
creator: sdk.wallet.bech32Address, | ||
sourceCoin: { | ||
denom: 'usdc', | ||
amount: '10000' | ||
} | ||
}) | ||
}]) | ||
|
||
console.log(result); | ||
})().catch((e) => { | ||
console.log({ e }) | ||
}).finally(() => process.exit(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import BigNumber from "bignumber.js"; | ||
import * as BIP39 from "bip39"; | ||
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; | ||
import { MsgDepositToGroup } from "../lib/codec"; | ||
import { CarbonSDK, CarbonTx } from "./_sdk"; | ||
import "./_setup"; | ||
|
||
(async () => { | ||
const mnemonics = process.env.MNEMONICS ?? BIP39.generateMnemonic(); | ||
console.log("mnemonics", mnemonics); | ||
|
||
const sdk = await CarbonSDK.instanceWithMnemonic(mnemonics, { network: CarbonSDK.Network.LocalHost}); | ||
|
||
const result = await sdk.wallet.sendTxs([{ | ||
typeUrl: CarbonTx.Types.MsgDepositToGroup, | ||
value: MsgDepositToGroup.fromPartial({ | ||
creator: sdk.wallet.bech32Address, | ||
depositCoin: { | ||
denom: 'usdc', | ||
amount: '10000' | ||
} | ||
}) | ||
}]) | ||
|
||
console.log(result); | ||
})().catch((e) => { | ||
console.log({ e }) | ||
}).finally(() => process.exit(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as BIP39 from "bip39"; | ||
import { MsgCreateGroup } from "../lib/codec"; | ||
import { CarbonSDK, CarbonTx } from "./_sdk"; | ||
import "./_setup"; | ||
|
||
(async () => { | ||
const mnemonics = process.env.MNEMONICS ?? BIP39.generateMnemonic(); | ||
console.log("mnemonics:", mnemonics); | ||
|
||
const sdk = await CarbonSDK.instance({ | ||
network: CarbonSDK.Network.LocalHost, | ||
config: { | ||
tmRpcUrl: process.env.TRPC_ENDPOINT, | ||
}, | ||
}); | ||
const connectedSDK = await sdk.connectWithMnemonic(mnemonics); | ||
console.log("connected sdk"); | ||
|
||
const result = await connectedSDK.wallet.sendTxs([{ | ||
typeUrl: CarbonTx.Types.MsgCreateGroup, | ||
value: MsgCreateGroup.fromPartial({ | ||
creator: connectedSDK.wallet.bech32Address, | ||
name: 'USD', | ||
chequeTokenSymbol: 'USD', | ||
oracleId: 'DXBT2' | ||
}), | ||
}]); | ||
console.log(result) | ||
})().catch(console.error).finally(() => process.exit(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as BIP39 from "bip39"; | ||
import { MsgRegisterToGroup } from "../lib/codec"; | ||
import { CarbonSDK, CarbonTx } from "./_sdk"; | ||
import "./_setup"; | ||
|
||
(async () => { | ||
const mnemonics = process.env.MNEMONICS ?? BIP39.generateMnemonic(); | ||
console.log("mnemonics:", mnemonics); | ||
|
||
// const sdk = await CarbonSDK.instanceWithMnemonic(mnemonics, { | ||
// network: CarbonSDK.Network.LocalHost, | ||
// }); | ||
|
||
const sdk = await CarbonSDK.instance({ | ||
network: CarbonSDK.Network.LocalHost, | ||
config: { | ||
tmRpcUrl: process.env.TRPC_ENDPOINT, | ||
}, | ||
}); | ||
const connectedSDK = await sdk.connectWithMnemonic(mnemonics); | ||
console.log("connected sdk"); | ||
|
||
const result = await connectedSDK.wallet.sendTxs([{ | ||
typeUrl: CarbonTx.Types.MsgRegisterToGroup, | ||
value: MsgRegisterToGroup.fromPartial({ | ||
creator: connectedSDK.wallet.bech32Address, | ||
groupId: '1', | ||
denom: 'usdc', | ||
}), | ||
}]); | ||
|
||
console.log(result); | ||
|
||
})().catch(console.error).finally(() => process.exit(0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.