Use new token names HASH/ISA/JADE
those don't conflict with other BCP demo tokens
This commit is contained in:
@@ -22,17 +22,17 @@ const defaultErc20Tokens: readonly Erc20Token[] = [
|
||||
{
|
||||
contractAddress: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
|
||||
fractionalDigits: 5,
|
||||
ticker: "ASH",
|
||||
ticker: "HASH",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd",
|
||||
fractionalDigits: 0,
|
||||
ticker: "BASH",
|
||||
ticker: "ISA",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
|
||||
fractionalDigits: 18,
|
||||
ticker: "CASH",
|
||||
ticker: "JADE",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -73,11 +73,11 @@ describe("CosmWasmCodec", () => {
|
||||
chainId: chainId,
|
||||
sender: "cosmos1txqfn5jmcts0x0q7krdxj8tgf98tj0965vqlmq" as Address,
|
||||
recipient: "cosmos1dddd" as Address,
|
||||
memo: "My first BASH payment",
|
||||
memo: "My first ISA payment",
|
||||
amount: {
|
||||
fractionalDigits: 0,
|
||||
quantity: "345",
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
},
|
||||
fee: {
|
||||
tokens: {
|
||||
@@ -91,7 +91,7 @@ describe("CosmWasmCodec", () => {
|
||||
|
||||
const expected = {
|
||||
bytes: toUtf8(
|
||||
'{"account_number":"0","chain_id":"cosmoshub-3","fee":{"amount":[{"amount":"2500","denom":"uatom"}],"gas":"100000"},"memo":"My first BASH payment","msgs":[{"type":"wasm/execute","value":{"contract":"cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd","msg":{"transfer":{"amount":"345","recipient":"cosmos1dddd"}},"sender":"cosmos1txqfn5jmcts0x0q7krdxj8tgf98tj0965vqlmq","sent_funds":[]}}],"sequence":"99"}',
|
||||
'{"account_number":"0","chain_id":"cosmoshub-3","fee":{"amount":[{"amount":"2500","denom":"uatom"}],"gas":"100000"},"memo":"My first ISA payment","msgs":[{"type":"wasm/execute","value":{"contract":"cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd","msg":{"transfer":{"amount":"345","recipient":"cosmos1dddd"}},"sender":"cosmos1txqfn5jmcts0x0q7krdxj8tgf98tj0965vqlmq","sent_funds":[]}}],"sequence":"99"}',
|
||||
),
|
||||
prehashType: PrehashType.Sha256,
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ const faucet = {
|
||||
|
||||
describe("CosmWasmConnection", () => {
|
||||
const cosm = "COSM" as TokenTicker;
|
||||
const bash = "BASH" as TokenTicker;
|
||||
const isa = "ISA" as TokenTicker;
|
||||
const httpUrl = "http://localhost:1317";
|
||||
const defaultChainId = "cosmos:testing" as ChainId;
|
||||
const defaultEmptyAddress = "cosmos1h806c7khnvmjlywdrkdgk2vrayy2mmvf9rxk2r" as Address;
|
||||
@@ -93,20 +93,20 @@ describe("CosmWasmConnection", () => {
|
||||
{
|
||||
contractAddress: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
|
||||
fractionalDigits: 5,
|
||||
ticker: "ASH",
|
||||
name: "Ash Token",
|
||||
ticker: "HASH",
|
||||
name: "Hash Token",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd",
|
||||
fractionalDigits: 0,
|
||||
ticker: "BASH",
|
||||
name: "Bash Token",
|
||||
ticker: "ISA",
|
||||
name: "Isa Token",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
|
||||
fractionalDigits: 18,
|
||||
ticker: "CASH",
|
||||
name: "Cash Token",
|
||||
ticker: "JADE",
|
||||
name: "Jade Token",
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -178,26 +178,26 @@ describe("CosmWasmConnection", () => {
|
||||
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
|
||||
const tokens = await connection.getAllTokens();
|
||||
expect(tokens).toEqual([
|
||||
{
|
||||
fractionalDigits: 5,
|
||||
tokenName: "Ash Token",
|
||||
tokenTicker: "ASH" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 0,
|
||||
tokenName: "Bash Token",
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 18,
|
||||
tokenName: "Cash Token",
|
||||
tokenTicker: "CASH" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 6,
|
||||
tokenName: "Fee Token",
|
||||
tokenTicker: "COSM" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 5,
|
||||
tokenName: "Hash Token",
|
||||
tokenTicker: "HASH" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 0,
|
||||
tokenName: "Isa Token",
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 18,
|
||||
tokenName: "Jade Token",
|
||||
tokenTicker: "JADE" as TokenTicker,
|
||||
},
|
||||
{
|
||||
fractionalDigits: 6,
|
||||
tokenName: "Staking Token",
|
||||
@@ -236,20 +236,20 @@ describe("CosmWasmConnection", () => {
|
||||
expect(account.pubkey).toBeUndefined();
|
||||
expect(account.balance).toEqual([
|
||||
{
|
||||
tokenTicker: "ASH" as TokenTicker,
|
||||
tokenTicker: "COSM" as TokenTicker,
|
||||
quantity: "1000000000",
|
||||
fractionalDigits: 6,
|
||||
},
|
||||
{
|
||||
tokenTicker: "HASH" as TokenTicker,
|
||||
quantity: "12812345",
|
||||
fractionalDigits: 5,
|
||||
},
|
||||
{
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
quantity: "42",
|
||||
fractionalDigits: 0,
|
||||
},
|
||||
{
|
||||
tokenTicker: "COSM" as TokenTicker,
|
||||
quantity: "1000000000",
|
||||
fractionalDigits: 6,
|
||||
},
|
||||
{
|
||||
tokenTicker: "STAKE" as TokenTicker,
|
||||
quantity: "1000000000",
|
||||
@@ -410,7 +410,7 @@ describe("CosmWasmConnection", () => {
|
||||
amount: {
|
||||
quantity: "345",
|
||||
fractionalDigits: 0,
|
||||
tokenTicker: bash,
|
||||
tokenTicker: isa,
|
||||
},
|
||||
});
|
||||
const nonce = await connection.getNonce({ address: senderAddress });
|
||||
@@ -1000,7 +1000,7 @@ describe("CosmWasmConnection", () => {
|
||||
amount: {
|
||||
quantity: "75",
|
||||
fractionalDigits: 0,
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
},
|
||||
});
|
||||
const nonce = await connection.getNonce({ address: senderAddress });
|
||||
@@ -1011,10 +1011,10 @@ describe("CosmWasmConnection", () => {
|
||||
expect(blockInfo.state).toEqual(TransactionState.Succeeded);
|
||||
|
||||
const recipientAccount = await connection.getAccount({ address: recipient });
|
||||
assert(recipientAccount, "Recipient account must have BASH tokens");
|
||||
assert(recipientAccount, "Recipient account must have ISA tokens");
|
||||
expect(recipientAccount.balance).toEqual([
|
||||
{
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
quantity: "75",
|
||||
fractionalDigits: 0,
|
||||
},
|
||||
|
||||
@@ -68,17 +68,17 @@ describe("decode", () => {
|
||||
{
|
||||
contractAddress: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
|
||||
fractionalDigits: 5,
|
||||
ticker: "ASH",
|
||||
ticker: "HASH",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd",
|
||||
fractionalDigits: 0,
|
||||
ticker: "BASH",
|
||||
ticker: "ISA",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
|
||||
fractionalDigits: 18,
|
||||
ticker: "CASH",
|
||||
ticker: "JADE",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -187,7 +187,7 @@ describe("decode", () => {
|
||||
recipient: "cosmos1z7g5w84ynmjyg0kqpahdjqpj7yq34v3suckp0e" as Address,
|
||||
amount: {
|
||||
quantity: "887878484",
|
||||
tokenTicker: "ASH" as TokenTicker,
|
||||
tokenTicker: "HASH" as TokenTicker,
|
||||
fractionalDigits: 5,
|
||||
},
|
||||
memo: defaultMemo,
|
||||
@@ -255,7 +255,7 @@ describe("decode", () => {
|
||||
recipient: "cosmos1z7g5w84ynmjyg0kqpahdjqpj7yq34v3suckp0e" as Address,
|
||||
amount: {
|
||||
quantity: "887878484",
|
||||
tokenTicker: "ASH" as TokenTicker,
|
||||
tokenTicker: "HASH" as TokenTicker,
|
||||
fractionalDigits: 5,
|
||||
},
|
||||
memo: defaultMemo,
|
||||
|
||||
@@ -53,17 +53,17 @@ describe("encode", () => {
|
||||
{
|
||||
contractAddress: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
|
||||
fractionalDigits: 5,
|
||||
ticker: "ASH",
|
||||
ticker: "HASH",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd",
|
||||
fractionalDigits: 0,
|
||||
ticker: "BASH",
|
||||
ticker: "ISA",
|
||||
},
|
||||
{
|
||||
contractAddress: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
|
||||
fractionalDigits: 18,
|
||||
ticker: "CASH",
|
||||
ticker: "JADE",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -83,7 +83,7 @@ describe("encode", () => {
|
||||
const amount: Amount = {
|
||||
quantity: "789",
|
||||
fractionalDigits: 0,
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
};
|
||||
expect(toErc20Amount(amount, bash)).toEqual("789");
|
||||
});
|
||||
@@ -92,7 +92,7 @@ describe("encode", () => {
|
||||
const amount: Amount = {
|
||||
quantity: "789",
|
||||
fractionalDigits: 0,
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
};
|
||||
expect(() => toErc20Amount(amount, ash)).toThrowError(/ticker mismatch/i);
|
||||
});
|
||||
@@ -101,7 +101,7 @@ describe("encode", () => {
|
||||
const amount: Amount = {
|
||||
quantity: "789",
|
||||
fractionalDigits: 2,
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
};
|
||||
expect(() => toErc20Amount(amount, bash)).toThrowError(/fractional digits mismatch/i);
|
||||
});
|
||||
@@ -298,7 +298,7 @@ describe("encode", () => {
|
||||
amount: {
|
||||
fractionalDigits: 0,
|
||||
quantity: "345",
|
||||
tokenTicker: "BASH" as TokenTicker,
|
||||
tokenTicker: "ISA" as TokenTicker,
|
||||
},
|
||||
fee: {
|
||||
tokens: {
|
||||
|
||||
Reference in New Issue
Block a user