From 70dd44d6cb6c3567fc0bbbe59b6b851d43dda553 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Thu, 14 Dec 2023 13:23:25 -0800 Subject: [PATCH] factory test --- .../__snapshots__/factory-tokens.test.ts.snap | 74 +++++++++++++++ .../keplr/__tests__/factory-tokens.test.ts | 91 +++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 packages/keplr/__tests__/__snapshots__/factory-tokens.test.ts.snap create mode 100644 packages/keplr/__tests__/factory-tokens.test.ts diff --git a/packages/keplr/__tests__/__snapshots__/factory-tokens.test.ts.snap b/packages/keplr/__tests__/__snapshots__/factory-tokens.test.ts.snap new file mode 100644 index 000000000..7df83e79d --- /dev/null +++ b/packages/keplr/__tests__/__snapshots__/factory-tokens.test.ts.snap @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`config 1`] = ` +{ + "bech32Config": { + "bech32PrefixAccAddr": "pryzm", + "bech32PrefixAccPub": "pryzmpub", + "bech32PrefixConsAddr": "pryzmvalcons", + "bech32PrefixConsPub": "pryzmvalconspub", + "bech32PrefixValAddr": "pryzmvaloper", + "bech32PrefixValPub": "pryzmvaloperpub", + }, + "bip44": { + "coinType": 118, + }, + "chainId": "PRYZM_CHAIN_ID", + "chainName": "Pryzm Testnet", + "currencies": [ + { + "coinDecimals": 6, + "coinDenom": "PRYZM", + "coinGeckoId": "pryzm", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg", + "coinMinimalDenom": "upryzm", + }, + { + "coinDecimals": undefined, + "coinDenom": "PRYZM2", + "coinGeckoId": "pryzm2", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg", + "coinMinimalDenom": "factory/pryzm15k9s9p0ar0cx27nayrgk6vmhyec3lj7vkry7rx/uusdsim", + }, + ], + "features": [ + "stargate", + "ibc-transfer", + ], + "feeCurrencies": [ + { + "coinDecimals": 6, + "coinDenom": "PRYZM", + "coinGeckoId": "pryzm", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg", + "coinMinimalDenom": "upryzm", + "gasPriceStep": { + "average": 0, + "high": 0.01, + "low": 0, + }, + }, + { + "coinDecimals": undefined, + "coinDenom": "PRYZM2", + "coinGeckoId": "pryzm2", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg", + "coinMinimalDenom": "factory/pryzm15k9s9p0ar0cx27nayrgk6vmhyec3lj7vkry7rx/uusdsim", + "gasPriceStep": { + "average": 0, + "high": 0.01, + "low": 0, + }, + }, + ], + "rest": "", + "rpc": "", + "stakeCurrency": { + "coinDecimals": 6, + "coinDenom": "PRYZM", + "coinGeckoId": "pryzm", + "coinImageUrl": "https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg", + "coinMinimalDenom": "upryzm", + }, +} +`; diff --git a/packages/keplr/__tests__/factory-tokens.test.ts b/packages/keplr/__tests__/factory-tokens.test.ts new file mode 100644 index 000000000..87b705992 --- /dev/null +++ b/packages/keplr/__tests__/factory-tokens.test.ts @@ -0,0 +1,91 @@ +import { chainRegistryChainToKeplr } from '@chain-registry/keplr'; +import { AssetList, Chain } from '@chain-registry/types'; +import { ChainInfo } from '@keplr-wallet/types'; + +const chain: Chain = { + chain_name: 'PRYZM_CHAIN_NAME', + chain_id: 'PRYZM_CHAIN_ID', + status: 'development', + network_type: 'testnet', + pretty_name: 'Pryzm Testnet', + bech32_prefix: 'pryzm', + slip44: 118, + staking: { + staking_tokens: [ + { + denom: 'upryzm' + } + ] + }, + fees: { + fee_tokens: [ + { + denom: 'upryzm', + fixed_min_gas_price: 0, + low_gas_price: 0, + average_gas_price: 0, + high_gas_price: 0.01 + }, + { + denom: 'factory/pryzm15k9s9p0ar0cx27nayrgk6vmhyec3lj7vkry7rx/uusdsim', + fixed_min_gas_price: 0, + low_gas_price: 0, + average_gas_price: 0, + high_gas_price: 0.01 + } + ] + } +}; + +const assets: AssetList = { + chain_name: 'PRYZM_CHAIN_NAME', + assets: [ + { + description: 'Pryzm token', + denom_units: [ + { + denom: 'upryzm', + exponent: 0 + }, + { + denom: 'pryzm', + exponent: 6 + } + ], + base: 'upryzm', + name: 'Pryzm', + display: 'pryzm', + symbol: 'PRYZM', + logo_URIs: { + png: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.png', + svg: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg' + }, + coingecko_id: 'pryzm' + }, + { + description: 'Another Pryzm token', + denom_units: [ + { + denom: 'factory/pryzm15k9s9p0ar0cx27nayrgk6vmhyec3lj7vkry7rx/uusdsim', + exponent: 0 + } + ], + base: 'factory/pryzm15k9s9p0ar0cx27nayrgk6vmhyec3lj7vkry7rx/uusdsim', + name: 'Pryzm2', + display: 'pryzm2', + symbol: 'PRYZM2', + logo_URIs: { + png: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.png', + svg: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/prism/images/prism-token.svg' + }, + coingecko_id: 'pryzm2' + } + ] +}; + +const config: ChainInfo = chainRegistryChainToKeplr(chain, [assets]); + +it('config', () => { + // console.log(config); + expect(config).toMatchSnapshot(); +});