-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/add_pepe_token_bsc' into feat/dynamic-token-list
- Loading branch information
Showing
9 changed files
with
222 additions
and
334 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
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
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
88 changes: 44 additions & 44 deletions
88
packages/examples/src/cosmjs-stargate/query-custom-height.ts
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 |
---|---|---|
@@ -1,48 +1,48 @@ | ||
import { StargateClient } from "@cosmjs/stargate"; | ||
import { ORAI } from "@oraichain/common"; | ||
import { assert } from "console"; | ||
import { setTimeout } from "timers/promises"; | ||
// import { StargateClient } from "@cosmjs/stargate"; | ||
// import { ORAI } from "@oraichain/common"; | ||
// import { assert } from "console"; | ||
// import { setTimeout } from "timers/promises"; | ||
|
||
(async () => { | ||
const rpc = "https://rpc.orai.io"; | ||
const { account: distributionAccount } = await fetch( | ||
"https://lcd.orai.io/cosmos/auth/v1beta1/module_accounts/distribution" | ||
).then((data) => data.json()); | ||
// (async () => { | ||
// const rpc = "https://rpc.orai.io"; | ||
// const { account: distributionAccount } = await fetch( | ||
// "https://lcd.orai.io/cosmos/auth/v1beta1/module_accounts/distribution" | ||
// ).then((data) => data.json()); | ||
|
||
const { address } = distributionAccount.base_account; | ||
const stargateClient = await StargateClient.connect(rpc); | ||
const latestHeight = await stargateClient.getHeight(); | ||
const { amount: distrBalance } = await stargateClient.getBalance( | ||
address, | ||
ORAI | ||
); | ||
const stargateClientTenHeightBefore = await StargateClient.connect(rpc, { | ||
desiredHeight: latestHeight - 10 | ||
}); | ||
const stargateClientDesiredFiveHeightBefore = await StargateClient.connect( | ||
rpc, | ||
{ | ||
desiredHeight: latestHeight - 5 | ||
} | ||
); | ||
// const { address } = distributionAccount.base_account; | ||
// const stargateClient = await StargateClient.connect(rpc); | ||
// const latestHeight = await stargateClient.getHeight(); | ||
// const { amount: distrBalance } = await stargateClient.getBalance( | ||
// address, | ||
// ORAI | ||
// ); | ||
// const stargateClientTenHeightBefore = await StargateClient.connect(rpc, { | ||
// desiredHeight: latestHeight - 10 | ||
// }); | ||
// const stargateClientDesiredFiveHeightBefore = await StargateClient.connect( | ||
// rpc, | ||
// { | ||
// desiredHeight: latestHeight - 5 | ||
// } | ||
// ); | ||
|
||
// query balance of distribution module at latest, 10 and 5 heights before that | ||
const { amount: distrBalanceTenBefore } = | ||
await stargateClientTenHeightBefore.getBalance(address, ORAI); | ||
const { amount: distrBalanceFiveBefore } = | ||
await stargateClientDesiredFiveHeightBefore.getBalance(address, ORAI); | ||
// // query balance of distribution module at latest, 10 and 5 heights before that | ||
// const { amount: distrBalanceTenBefore } = | ||
// await stargateClientTenHeightBefore.getBalance(address, ORAI); | ||
// const { amount: distrBalanceFiveBefore } = | ||
// await stargateClientDesiredFiveHeightBefore.getBalance(address, ORAI); | ||
|
||
// after several blocks, the balances 10 heights before should stay the same, proving that we can query states at a specific height | ||
await setTimeout(2000); | ||
const { amount: distrBalanceTenBeforeAgain } = | ||
await stargateClientTenHeightBefore.getBalance(address, ORAI); | ||
assert(distrBalanceTenBeforeAgain === distrBalanceTenBefore); | ||
assert(distrBalanceTenBeforeAgain !== distrBalance); | ||
assert(distrBalanceTenBeforeAgain !== distrBalanceFiveBefore); | ||
console.log( | ||
distrBalance, | ||
distrBalanceTenBefore, | ||
distrBalanceTenBeforeAgain, | ||
distrBalanceFiveBefore | ||
); | ||
})(); | ||
// // after several blocks, the balances 10 heights before should stay the same, proving that we can query states at a specific height | ||
// await setTimeout(2000); | ||
// const { amount: distrBalanceTenBeforeAgain } = | ||
// await stargateClientTenHeightBefore.getBalance(address, ORAI); | ||
// assert(distrBalanceTenBeforeAgain === distrBalanceTenBefore); | ||
// assert(distrBalanceTenBeforeAgain !== distrBalance); | ||
// assert(distrBalanceTenBeforeAgain !== distrBalanceFiveBefore); | ||
// console.log( | ||
// distrBalance, | ||
// distrBalanceTenBefore, | ||
// distrBalanceTenBeforeAgain, | ||
// distrBalanceFiveBefore | ||
// ); | ||
// })(); |
50 changes: 25 additions & 25 deletions
50
packages/examples/src/cosmwasm-stargate/basic-custom-height.ts
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import dotenv from "dotenv"; | ||
import { ORAI_TOKEN_CONTRACTS } from "@oraichain/common"; | ||
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; | ||
import assert from "assert"; | ||
dotenv.config(); | ||
// import dotenv from "dotenv"; | ||
// import { ORAI_TOKEN_CONTRACTS } from "@oraichain/common"; | ||
// import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; | ||
// import assert from "assert"; | ||
// dotenv.config(); | ||
|
||
(async () => { | ||
const oldStatus = await queryCheckpointByIndex(process.env.RPC, 36975367); | ||
const newStatus = await queryCheckpointByIndex(process.env.RPC, 36975369); | ||
// (async () => { | ||
// const oldStatus = await queryCheckpointByIndex(process.env.RPC, 36975367); | ||
// const newStatus = await queryCheckpointByIndex(process.env.RPC, 36975369); | ||
|
||
assert(oldStatus !== newStatus); | ||
})(); | ||
// assert(oldStatus !== newStatus); | ||
// })(); | ||
|
||
async function queryCheckpointByIndex( | ||
rpc: string, | ||
height: number | ||
): Promise<string> { | ||
const client = await SigningCosmWasmClient.connect(rpc, height); | ||
// client.setQueryClientWithHeight(36975367); | ||
const result = await client.queryContractSmart( | ||
"orai12sxqkgsystjgd9faa48ghv3zmkfqc6qu05uy20mvv730vlzkpvls5zqxuz", | ||
{ | ||
checkpoint_by_index: { index: 13 } | ||
} | ||
); | ||
console.log(result.status); | ||
return result.status; | ||
} | ||
// async function queryCheckpointByIndex( | ||
// rpc: string, | ||
// height: number | ||
// ): Promise<string> { | ||
// const client = await SigningCosmWasmClient.connect(rpc, height); | ||
// // client.setQueryClientWithHeight(36975367); | ||
// const result = await client.queryContractSmart( | ||
// "orai12sxqkgsystjgd9faa48ghv3zmkfqc6qu05uy20mvv730vlzkpvls5zqxuz", | ||
// { | ||
// checkpoint_by_index: { index: 13 } | ||
// } | ||
// ); | ||
// console.log(result.status); | ||
// return result.status; | ||
// } |
Oops, something went wrong.