Skip to content

Commit

Permalink
Merge pull request #66 from leapwallet/main
Browse files Browse the repository at this point in the history
Bump version Snap - 0.1.17 and provider 0.1.25
  • Loading branch information
leapsamvel committed Oct 31, 2023
2 parents af8f4f8 + bcc5099 commit 7673a22
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
env:
GH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gitHub-registry:
runs-on: ubuntu-latest
env:
Expand All @@ -63,7 +63,7 @@ jobs:
run: yarn
env:
GH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}

- name: 🏗️ Build Library
run: yarn build:provider && yarn publish:provider
env:
Expand Down
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.2.1.cjs
yarnPath: .yarn/releases/yarn-3.2.1.cjs
1 change: 0 additions & 1 deletion packages/cosmos-snap-provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

The **`cosmos-snap-provider`** is specifically designed for seamless integration of the Leap Cosmos Snap with the [CosmJS](https://github.com/cosmos/cosmjs) client.


[Integration Guide](https://docs.leapwallet.io/cosmos/leap-metamask-snap/integrating-snaps/cosmos-snap-provider)
2 changes: 1 addition & 1 deletion packages/cosmos-snap-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@leapwallet/cosmos-snap-provider",
"version": "0.1.24",
"version": "0.1.25",
"repository": {
"url": "[email protected]:leapwallet/cosmos-metamask-snap.git"
},
Expand Down
60 changes: 48 additions & 12 deletions packages/cosmos-snap-provider/src/constants/chainInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,29 +179,29 @@ const Chains = {
denom: 'uc4e',
decimals: 6,
},
'cheqd-mainnet-1': {
chainId: 'cheqd-mainnet-1',
chainName: 'cheqd',
celestia: {
chainId: 'celestia',
chainName: 'Celestia',
bech32Config: {
bech32PrefixAccAddr: 'cheqd',
bech32PrefixAccAddr: 'celestia',
},
bip44: {
coinType: 118,
},
denom: 'ncheq',
decimals: 9,
denom: 'utia',
decimals: 6,
},
'morocco-1': {
chainId: 'morocco-1',
chainName: 'chronicnetwork',
'cheqd-mainnet-1': {
chainId: 'cheqd-mainnet-1',
chainName: 'cheqd',
bech32Config: {
bech32PrefixAccAddr: 'chronic',
bech32PrefixAccAddr: 'cheqd',
},
bip44: {
coinType: 118,
},
denom: 'ucht',
decimals: 6,
denom: 'ncheq',
decimals: 9,
},
'comdex-1': {
chainId: 'comdex-1',
Expand Down Expand Up @@ -311,6 +311,18 @@ const Chains = {
denom: 'udec',
decimals: 6,
},
'morocco-1': {
chainId: 'morocco-1',
chainName: 'terpnetwork',
bech32Config: {
bech32PrefixAccAddr: 'terp',
},
bip44: {
coinType: 118,
},
denom: 'uterp',
decimals: 6,
},
'desmos-mainnet': {
chainId: 'desmos-mainnet',
chainName: 'desmos',
Expand All @@ -335,6 +347,18 @@ const Chains = {
denom: 'udig',
decimals: 6,
},
dydx: {
chainId: 'dydx-mainnet-1',
chainName: 'dYdX Protocol',
bech32Config: {
bech32PrefixAccAddr: 'dydx',
},
bip44: {
coinType: 118,
},
denom: 'DYDX',
decimals: 18,
},
'dyson-mainnet-01': {
chainId: 'dyson-mainnet-01',
chainName: 'dyson',
Expand Down Expand Up @@ -1151,6 +1175,18 @@ const Chains = {
denom: 'uvdl',
decimals: 6,
},
'vota-ash': {
chainId: 'vota-ash',
chainName: 'doravota',
bech32Config: {
bech32PrefixAccAddr: 'dora',
},
bip44: {
coinType: 118,
},
denom: 'peaka',
decimals: 18,
},
};

export default Chains;
7 changes: 5 additions & 2 deletions packages/cosmos-snap-provider/src/cosmjs-offline-signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint jsdoc/match-description: 0 */ // --> OFF
/* eslint require-atomic-updates: 0 */ // --> OFF
/* eslint jsdoc/require-param: 0 */ // --> OFF

import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { AccountData, AminoSignResponse } from '@cosmjs/amino';
Expand Down Expand Up @@ -64,7 +65,7 @@ export class CosmjsOfflineSigner implements OfflineDirectSigner {
this.chainId,
signerAddress,
signDoc,
options
options,
) as unknown as Promise<AminoSignResponse>;
}
}
Expand All @@ -91,11 +92,13 @@ export async function signArbitrary(
chainId: string,
signer: string,
data: string,
signOptions?: { enableExtraEntropy?: boolean },
) {
const { signDoc } = getADR36SignDoc(signer, data);
const result = await requestSignAmino(chainId, signer, signDoc, {
isADR36: true,
preferNoSetFee: true
preferNoSetFee: true,
enableExtraEntropy: signOptions?.enableExtraEntropy,
});
return result.signature;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/cosmos-snap-provider/src/snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const requestSignAmino = async (
signDoc: StdSignDoc,
options?: SignAminoOptions,
) => {
const { isADR36 = false } = options || {};
const { isADR36 = false, enableExtraEntropy = false } = options || {};

if (!isADR36 && chainId !== signDoc.chain_id) {
throw new Error('Chain ID does not match signer chain ID');
Expand Down Expand Up @@ -203,6 +203,7 @@ export const requestSignAmino = async (
signerAddress,
signDoc,
isADR36,
enableExtraEntropy,
})) as AminoSignResponse;

return signResponse;
Expand Down
7 changes: 4 additions & 3 deletions packages/cosmos-snap-provider/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type Snap = {
permissionName: string;
id: string;
version: string;
initialPermissions: Record<string, unknown>;
initialPermissions: Record<string, unknown>;
};

export type Bech32Config = {
Expand Down Expand Up @@ -78,6 +78,7 @@ export type ChainInfo = {
export type SignAminoOptions = {
preferNoSetFee?: boolean;
isADR36?: boolean;
enableExtraEntropy?: boolean;
};

export type StdFee = {
Expand All @@ -100,5 +101,5 @@ export type StdSignDoc = {
export type ProviderLong = Long;

export type SuggestChainOptions = {
force?: boolean
}
force?: boolean;
};
2 changes: 1 addition & 1 deletion packages/snap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This Snap facilitates signing of Cosmos transactions for chains associated with

> Recommendation: If you're accustomed to using [CosmJS](https://github.com/cosmos/cosmjs) and the OfflineSigner, consider leveraging our cosmos-snap-provider. It streamlines the necessary tasks with minimal code alterations.
[Integration docs](https://docs.leapwallet.io/cosmos/leap-metamask-snap/integrating-snaps/metamask-cosmos-snap)
[Integration docs](https://docs.leapwallet.io/cosmos/leap-metamask-snap/integrating-snaps/metamask-cosmos-snap)
2 changes: 1 addition & 1 deletion packages/snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@leapwallet/metamask-cosmos-snap",
"version": "0.1.16",
"version": "0.1.17",
"description": "Securely manage keys, connect to Cosmos dapps, and sign transactions.",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "0.1.16",
"version": "0.1.17",
"description": "Securely manage keys, connect to Cosmos dapps, and sign transactions.",
"proposedName": "Leap Cosmos Wallet",
"repository": {
"type": "git",
"url": "https://github.com/leapwallet/cosmos-metamask-snap.git"
},
"source": {
"shasum": "diCk3Ht/3Fhbn089viNkY9N6dr41wCMm1KR0wJhLzm0=",
"shasum": "CLwZocaUEbDErtQAsybaudZDJq65a8AwlEFgkGUpmAQ=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
34 changes: 32 additions & 2 deletions packages/snap/src/constants/chainInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ const Chains = {
coinType: 4444,
},
},
celestia: {
chainId: 'celestia',
chainName: 'Celestia',
bech32Config: {
bech32PrefixAccAddr: 'celestia',
},
bip44: {
coinType: 118,
},
},
'cheqd-mainnet-1': {
chainId: 'cheqd-mainnet-1',
chainName: 'cheqd',
Expand All @@ -161,9 +171,9 @@ const Chains = {
},
'morocco-1': {
chainId: 'morocco-1',
chainName: 'chronicnetwork',
chainName: 'terpnetwork',
bech32Config: {
bech32PrefixAccAddr: 'chronic',
bech32PrefixAccAddr: 'terp',
},
bip44: {
coinType: 118,
Expand Down Expand Up @@ -279,6 +289,16 @@ const Chains = {
coinType: 118,
},
},
dydx: {
chainId: 'dydx-mainnet-1',
chainName: 'dYdX Protocol',
bech32Config: {
bech32PrefixAccAddr: 'dydx',
},
bip44: {
coinType: '118',
},
},
'dyson-mainnet-01': {
chainId: 'dyson-mainnet-01',
chainName: 'dyson',
Expand Down Expand Up @@ -969,6 +989,16 @@ const Chains = {
coinType: 370,
},
},
'vota-ash': {
chainId: 'vota-ash',
chainName: 'doravota',
bech32Config: {
bech32PrefixAccAddr: 'dora',
},
bip44: {
coinType: 118,
},
},
};

export default Chains;
57 changes: 32 additions & 25 deletions packages/snap/src/constants/denoms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
const DENOMS = {
adydx: {
coinDenom: 'DYDX',
coinDecimals: 18,
coinMinimalDenom: 'adydx',
icon: 'https://assets.leapwallet.io/dydx.png',
chain: 'dydx',
coinGeckoId: 'dydx',
},
utia: {
coinDenom: 'TIA',
coinDecimals: 6,
coinMinimalDenom: 'utia',
icon: 'https://assets.leapwallet.io/filled-celestia.svg',
chain: 'celestia',
coinGeckoId: '',
},
umpwr: {
coinDenom: 'MPWR',
coinMinimalDenom: 'umpwr',
Expand Down Expand Up @@ -386,27 +402,27 @@ const DENOMS = {
icon: 'https://assets.leapwallet.io/huahua.png',
chain: 'chihuahua',
},
ucht: {
name: 'Chronic Token',
uterp: {
name: 'Terp Token',
description:
'The CHT coin is the governance token within the Chronic Chain network, aimed to serve the entire cannabis community through its payment network, supply chain and trust network.',
coinDenom: 'CHT',
coinMinimalDenom: 'ucht',
'Terp Token (TERP) is the Terp Networks native utility token, used as the primary means to govern & secure the blockchain.',
coinDenom: 'TERP',
coinMinimalDenom: 'uterp',
coinDecimals: 6,
coinGeckoId: 'cht',
icon: 'https://assets.leapwallet.io/cht.png',
chain: 'chronicnetwork',
coinGeckoId: null,
icon: 'https://assets.leapwallet.io/terp.png',
chain: 'terpnetwork',
},
ucgas: {
name: 'Chronic Gas',
uthiol: {
name: 'Thiol Gas Token',
description:
'The CGAS coin is the transactional token within the Chronic Chain network, aimed to serve the entire cannabis community through its payment network, supply chain and trust network.',
coinDenom: 'CGAS',
coinMinimalDenom: 'ucgas',
'Thiol Gas Token (Thiols) is the Terp Networks native utility token, used as the primary means to govern, secure the blockchain & incentivize participants',
coinDenom: 'TERP',
coinMinimalDenom: 'uthiol',
coinDecimals: 6,
coinGeckoId: 'cgas',
icon: 'https://assets.leapwallet.io/cgas.png',
chain: 'chronicnetwork',
coinGeckoId: null,
icon: 'https://assets.leapwallet.io/thiol.png',
chain: 'terpnetwork',
},
ucmdx: {
name: 'Comdex',
Expand Down Expand Up @@ -1837,15 +1853,6 @@ const DENOMS = {
chain: 'planq',
coinGeckoId: 'planq',
},
utia: {
name: 'Celestia',
coinDenom: 'TIA',
coinMinimalDenom: 'utia',
coinDecimals: 6,
icon: 'https://assets.leapwallet.io/celestia.png',
chain: 'celestiatestnet',
coinGeckoId: '',
},
juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr: {
name: 'Neta',
description: 'The native token cw20 for Neta on Juno Chain',
Expand Down
1 change: 0 additions & 1 deletion packages/snap/src/helpers/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import * as base64js from 'base64-js';

import BigNumber from 'bignumber.js';
import DENOMS from '../constants/denoms';
import { base64 } from '@metamask/utils';

const messageParser = new MessageParser();

Expand Down
Loading

0 comments on commit 7673a22

Please sign in to comment.