-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97fa94c
commit fa454c8
Showing
16 changed files
with
189 additions
and
95 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,51 @@ | ||
# [0.14.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.14.0) (2023-08-03) | ||
|
||
|
||
|
||
# [0.13.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.13.0) (2023-08-01) | ||
|
||
|
||
|
||
# [0.9.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.9.0) (2023-07-31) | ||
|
||
|
||
|
||
# [0.7.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.7.0) (2023-07-11) | ||
|
||
|
||
|
||
# [0.6.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.6.0) (2023-07-11) | ||
|
||
|
||
### Reverts | ||
|
||
* Revert "support for rango-types cjs format" ([ed4e050](https://github.com/rango-exchange/rango-client/commit/ed4e050bfc0dcde7aeffa6b0d73b02080a5721eb)) | ||
* Revert "support for rango-types cjs format" ([4f5f55f](https://github.com/rango-exchange/rango-client/commit/4f5f55f96e8daa329588b932b19c291c30f339c4)) | ||
|
||
|
||
|
||
# [0.5.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.5.0) (2023-05-31) | ||
|
||
|
||
|
||
# [0.4.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.4.0) (2023-05-31) | ||
|
||
|
||
|
||
# [0.3.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.3.0) (2023-05-30) | ||
|
||
|
||
|
||
# [0.2.0](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.2.0) (2023-05-30) | ||
|
||
|
||
|
||
## [0.1.14](https://github.com/rango-exchange/rango-client/compare/[email protected]@0.1.14) (2023-05-15) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* update rango-types and fix notification bugs ([993f185](https://github.com/rango-exchange/rango-client/commit/993f185e0b8c5e5e15a2c65ba2d85d1f9c8daa90)) | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# @rango-dev/provider-cosmos-snap |
20 changes: 19 additions & 1 deletion
20
wallets/provider-metamask/src/snap.ts → wallets/provider-cosmos-snap/src/helpers.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
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,82 @@ | ||
import type { | ||
CanEagerConnect, | ||
CanSwitchNetwork, | ||
Connect, | ||
ProviderConnectResult, | ||
Subscribe, | ||
WalletInfo, | ||
} from '@rango-dev/wallets-shared'; | ||
import type { BlockchainMeta, SignerFactory } from 'rango-types'; | ||
|
||
import { | ||
canEagerlyConnectToEvm, | ||
subscribeToEvm, | ||
WalletTypes, | ||
} from '@rango-dev/wallets-shared'; | ||
import { cosmosBlockchains } from 'rango-types'; | ||
|
||
import { | ||
getAddresses, | ||
installCosmosSnap, | ||
isCosmosSnapInstalled, | ||
metamask as metamask_instance, | ||
} from './helpers'; | ||
import signer from './signer'; | ||
|
||
const WALLET = WalletTypes.COSMOS_SNAP; | ||
|
||
export const config = { | ||
type: WALLET, | ||
}; | ||
|
||
export const getInstance = metamask_instance; | ||
export const connect: Connect = async ({ instance }) => { | ||
/* | ||
* cosmos snap (It's optional) | ||
* If the user approves to install Snap, we take the Cosmos addresses and add them to the accounts. | ||
*/ | ||
await installCosmosSnap(instance); | ||
const installed = await isCosmosSnapInstalled(instance); | ||
let accounts: ProviderConnectResult[] = []; | ||
if (installed) { | ||
const addresses = await getAddresses(instance); | ||
accounts = addresses.map((item) => ({ | ||
accounts: [item.address], | ||
chainId: item.chain_id, | ||
})); | ||
} | ||
if (!accounts.length) { | ||
throw new Error('You have rejected to install cosmos-snap'); | ||
} | ||
return accounts; | ||
}; | ||
|
||
export const subscribe: Subscribe = subscribeToEvm; | ||
|
||
export const canSwitchNetworkTo: CanSwitchNetwork = () => false; | ||
|
||
export const getSigners: (provider: any) => SignerFactory = signer; | ||
|
||
export const canEagerConnect: CanEagerConnect = canEagerlyConnectToEvm; | ||
|
||
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = ( | ||
allBlockChains | ||
) => { | ||
const cosmos = cosmosBlockchains(allBlockChains); | ||
return { | ||
name: 'Cosmos Snap', | ||
img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/metamask/icon.svg', | ||
installLink: { | ||
CHROME: | ||
'https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en', | ||
BRAVE: | ||
'https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en', | ||
|
||
FIREFOX: 'https://addons.mozilla.org/en-US/firefox/addon/ether-metamask', | ||
EDGE: 'https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm?hl=en-US', | ||
DEFAULT: 'https://metamask.io/download/', | ||
}, | ||
color: '#dac7ae', | ||
supportedChains: cosmos, | ||
}; | ||
}; |
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,11 @@ | ||
import type { SignerFactory } from 'rango-types'; | ||
|
||
import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; | ||
|
||
import StarknetSigner from './signers/cosmos'; | ||
|
||
export default function getSigners(provider: any): SignerFactory { | ||
const signers = new DefaultSignerFactory(); | ||
signers.registerSigner(TxType.STARKNET, new StarknetSigner(provider)); | ||
return signers; | ||
} |
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
File renamed without changes.
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,9 @@ | ||
export interface AccContract { | ||
addressSalt: string; | ||
publicKey: string; // in hex | ||
address: string; // in hex | ||
addressIndex: number; | ||
derivationPath: string; | ||
deployTxnHash: string; // in hex | ||
chainId: string; // in hex | ||
} |
2 changes: 1 addition & 1 deletion
2
signers/signer-cosmos-snap/tsconfig.json → wallets/provider-cosmos-snap/tsconfig.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import type { SignerFactory } from 'rango-types'; | ||
|
||
import { DefaultCosmosSnapSigner } from '@rango-dev/signer-cosmos-snap'; | ||
import { DefaultEvmSigner } from '@rango-dev/signer-evm'; | ||
import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; | ||
|
||
export default function getSigners(provider: any): SignerFactory { | ||
const signers = new DefaultSignerFactory(); | ||
signers.registerSigner(TxType.EVM, new DefaultEvmSigner(provider)); | ||
signers.registerSigner(TxType.COSMOS, new DefaultCosmosSnapSigner(provider)); | ||
|
||
return signers; | ||
} |
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