Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated solana chain in safle vault #317

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,9 @@
### 2.6.2 (2024-05-31)

* Updated add account for stacks addresses
* Upgraded stacks controller version
* Upgraded stacks controller version

### 2.7.0 (2024-07-25)

* Integrated solana chain in safle vault
* Updated test cases
1,948 changes: 1,588 additions & 360 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getsafle/safle-vault",
"version": "2.6.2",
"version": "2.7.0",
"description": "Safle Vault is a non-custodial, flexible and highly available crypto wallet which can be used to access dapps, send/receive crypto and store identity. Vault SDK is used to manage the vault and provide methods to generate vault, add new accounts, update the state and also enable the user to perform several vault related operations.",
"main": "src/index.js",
"scripts": {
Expand Down Expand Up @@ -56,6 +56,7 @@
"@getsafle/vault-optimism-controller": "^1.0.8",
"@getsafle/vault-polygon-controller": "^1.2.8",
"@getsafle/vault-polygon-zkevm-controller": "^1.0.1",
"@getsafle/vault-sol-controller": "^1.0.1",
"@getsafle/vault-stacks-controller": "^1.0.5",
"@getsafle/vault-velas-controller": "^1.3.1",
"bip39": "^3.0.4",
Expand Down
5 changes: 4 additions & 1 deletion src/chains/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ const avalanche=require('@getsafle/vault-avalanche-controller')
const base = require('@getsafle/vault-base-controller')
const zkEVM = require('@getsafle/vault-polygon-zkevm-controller')
const stacks = require('@getsafle/vault-stacks-controller');
const solana = require('@getsafle/vault-sol-controller');


const evmChains = { 'ethereum': 'ETH', 'bsc': 'BSC', 'polygon': 'MATIC', 'optimism': 'OP' ,'arbitrum': 'ARB', 'mantle': 'MNT', 'velas': 'VLX' , 'avalanche': 'AVAX', 'base':'BASE', 'zkEVM': 'ZKEVM'};
const nonEvmChains = { 'bitcoin': 'BTC', 'stacks': 'STX' };
const nonEvmChains = { 'bitcoin': 'BTC', 'stacks': 'STX', 'solana': 'SOL' };

module.exports = {
ethereum,
Expand All @@ -27,6 +29,7 @@ module.exports = {
base,
zkEVM,
stacks,
solana,
evmChains,
nonEvmChains,
}
1 change: 1 addition & 0 deletions src/lib/test/keyring.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ describe('getActiveChains',()=>{
response: [
{ chain: 'bitcoin', symbol: 'BTC' },
{ chain: 'stacks', symbol: 'STX' },
{ chain: 'solana', symbol: 'SOL' },
{ chain: 'ethereum', symbol: 'ETH' },
{ chain: 'bsc', symbol: 'BSC' },
{ chain: 'polygon', symbol: 'MATIC' },
Expand Down
2 changes: 1 addition & 1 deletion src/lib/test/vault.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('getSupportedChains' , ()=>{
let result = await new Vault({}).getSupportedChains()
expect({
evmChains: { ethereum: 'ETH', bsc: 'BSC', polygon: 'MATIC', optimism: 'OP', arbitrum: 'ARB', mantle: 'MNT', velas: 'VLX', avalanche: 'AVAX', base:'BASE', zkEVM: 'ZKEVM'},
nonEvmChains: { bitcoin: 'BTC', stacks: 'STX' }
nonEvmChains: { bitcoin: 'BTC', stacks: 'STX', solana: 'SOL' }
}).toMatchObject(result.response)
})

Expand Down
4 changes: 4 additions & 0 deletions src/lib/vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const CryptoJS = require('crypto-js');
const { KeyringController } = require('@getsafle/vault-eth-controller');
const BitcoinKeyringController= require('@getsafle/vault-bitcoin-controller').KeyringController ;
const StacksKeyringController = require('@getsafle/vault-stacks-controller').KeyringController;
const SolanaKeyringController = require('@getsafle/vault-sol-controller').KeyringController;
const bip39 = require('bip39');

const helper = require('../utils/helper');
Expand Down Expand Up @@ -57,6 +58,9 @@ class Vault extends Keyring {

const stacksKeyringController = new StacksKeyringController({mnemonic:mnemonic});
this["stacks"] = stacksKeyringController;

const solanaKeyringController = new SolanaKeyringController({mnemonic:mnemonic});
this["solana"] = solanaKeyringController;
}

async generateMnemonic(entropy) {
Expand Down
Loading