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

feat: add vultisig support #1141

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
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
Binary file modified bun.lockb
Binary file not shown.
11 changes: 9 additions & 2 deletions packages/swapkit/helpers/src/helpers/web3wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,14 @@ export function getEIP6963Wallets() {
const providers: EIP6963Provider[] = [];

function onAnnouncement(event: EIP6963AnnounceProviderEvent) {
if (providers.map((p) => p.info.uuid).includes(event.detail.info.uuid)) return;
// FIXME: vultisig announces provider with new UUID each time, so this is workaround to replace entries

const existingIndex = providers.findIndex((p) => p.info.name === event.detail.info.name);

if (existingIndex !== -1) {
providers.splice(existingIndex, 1);
}

providers.push(event.detail);
}

Expand All @@ -217,7 +224,7 @@ export function getEIP6963Wallets() {
function removeEIP6963EventListener() {
window.removeEventListener("eip6963:announceProvider", onAnnouncement);
}

console.log(providers, "providers");
return { providers, removeEIP6963EventListener };
}

Expand Down
5 changes: 5 additions & 0 deletions packages/swapkit/helpers/src/modules/swapKitError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ const errorCodes = {
wallet_keepkey_contract_address_not_provided: 20902,
wallet_keepkey_send_transaction_no_address: 20903,
wallet_bitkeep_not_found: 21001,
wallet_vultisig_not_found: 21100,
wallet_vultisig_asset_not_defined: 21101,
wallet_vultisig_contract_address_not_provided: 21102,
wallet_vultisig_send_transaction_no_address: 21103,
wallet_vultisig_no_account_found: 21104,
/**
* Chainflip
*/
Expand Down
1 change: 1 addition & 0 deletions packages/swapkit/helpers/src/types/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export type WalletTxParams = {
from?: string;
memo?: string; // optional memo to pass
recipient: string;
gasLimit?: string | bigint | undefined;
};

export enum MemoType {
Expand Down
1 change: 1 addition & 0 deletions packages/swapkit/helpers/src/types/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export enum WalletOption {
TALISMAN = "TALISMAN",
TRUSTWALLET_WEB = "TRUSTWALLET_WEB",
WALLETCONNECT = "WALLETCONNECT",
VULTISIG = "VULTISIG",
}

export enum LedgerErrorCode {
Expand Down
3 changes: 2 additions & 1 deletion packages/swapkit/wallets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { polkadotWallet } from "@swapkit/wallet-polkadotjs";
import { radixWallet } from "@swapkit/wallet-radix";
import { talismanWallet } from "@swapkit/wallet-talisman";
import { trezorWallet } from "@swapkit/wallet-trezor";
import { vultisigWallet } from "@swapkit/wallet-vultisig";
import { walletconnectWallet } from "@swapkit/wallet-wc";

export const wallets = {
...bitgetWallet,
...coinbaseWallet,
Expand All @@ -32,4 +32,5 @@ export const wallets = {
...trezorWallet,
...walletconnectWallet,
...ctrlWallet,
...vultisigWallet,
};
4 changes: 4 additions & 0 deletions packages/wallets/vultisig/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { buildPackage } from "../../../tools/builder";
import { dependencies } from "./package.json";

buildPackage({ dependencies });
32 changes: 32 additions & 0 deletions packages/wallets/vultisig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"description": "SwapKit Wallet - vultisig",
"dependencies": {
"@swapkit/helpers": "workspace:*",
"@swapkit/toolbox-cosmos": "workspace:*",
"@swapkit/toolbox-evm": "workspace:*",
"@swapkit/toolbox-utxo": "workspace:*"
},
"files": [
"src/",
"dist/"
],
"homepage": "https://github.com/thorswap/SwapKit",
"license": "Apache-2.0",
"main": "./dist/index.js",
"name": "@swapkit/wallet-vultisig",
"repository": {
"type": "git",
"url": "git+https://github.com/thorswap/SwapKit.git"
},
"scripts": {
"build": "bun run ./build.ts",
"clean": "rm -rf dist node_modules *.tsbuildinfo",
"lint": "biome check --diagnostic-level=error --write ./src",
"test": "echo 'bun test'",
"test:coverage": "bun test --coverage",
"type-check": "tsc --noEmit"
},
"type": "module",
"types": "./src/index.ts",
"version": "1.0.3"
}
Loading
Loading