@meshconnect/web-link-sdk 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Link.js +5 -317
- package/package.json +3 -7
- package/utils/types.d.ts +0 -93
- package/utils/version.d.ts +1 -1
- package/utils/version.js +1 -1
- package/utils/connectors/evm/chainConfigs.d.ts +0 -2
- package/utils/connectors/evm/chainConfigs.js +0 -115
- package/utils/connectors/evm/chainSwitching.d.ts +0 -15
- package/utils/connectors/evm/chainSwitching.js +0 -242
- package/utils/connectors/evm/index.d.ts +0 -8
- package/utils/connectors/evm/index.js +0 -8
- package/utils/connectors/evm/provider.d.ts +0 -6
- package/utils/connectors/evm/provider.js +0 -13
- package/utils/connectors/evm/signing.d.ts +0 -1
- package/utils/connectors/evm/signing.js +0 -78
- package/utils/connectors/evm/transactions.d.ts +0 -28
- package/utils/connectors/evm/transactions.js +0 -381
- package/utils/connectors/evm/types.d.ts +0 -57
- package/utils/connectors/evm/types.js +0 -1
- package/utils/connectors/evm/walletConnection.d.ts +0 -20
- package/utils/connectors/evm/walletConnection.js +0 -160
- package/utils/connectors/evm/walletDiscovery.d.ts +0 -10
- package/utils/connectors/evm/walletDiscovery.js +0 -55
- package/utils/connectors/solana/connection.d.ts +0 -4
- package/utils/connectors/solana/connection.js +0 -108
- package/utils/connectors/solana/index.d.ts +0 -5
- package/utils/connectors/solana/index.js +0 -5
- package/utils/connectors/solana/providerDiscovery.d.ts +0 -3
- package/utils/connectors/solana/providerDiscovery.js +0 -127
- package/utils/connectors/solana/signing.d.ts +0 -1
- package/utils/connectors/solana/signing.js +0 -59
- package/utils/connectors/solana/transaction.d.ts +0 -17
- package/utils/connectors/solana/transaction.js +0 -362
- package/utils/connectors/solana/types.d.ts +0 -71
- package/utils/connectors/solana/types.js +0 -8
- package/utils/wallet/EVMWalletStrategy.d.ts +0 -31
- package/utils/wallet/EVMWalletStrategy.js +0 -265
- package/utils/wallet/SolanaWalletStrategy.d.ts +0 -33
- package/utils/wallet/SolanaWalletStrategy.js +0 -300
- package/utils/wallet/WalletStrategy.d.ts +0 -61
- package/utils/wallet/WalletStrategy.js +0 -25
- package/utils/wallet/WalletStrategyFactory.d.ts +0 -15
- package/utils/wallet/WalletStrategyFactory.js +0 -31
- package/utils/wallet/index.d.ts +0 -4
- package/utils/wallet/index.js +0 -4
- package/utils/wallet-browser-event-types.d.ts +0 -116
- package/utils/wallet-browser-event-types.js +0 -17
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var BaseWalletStrategy = /** @class */ (function () {
|
|
2
|
-
function BaseWalletStrategy() {
|
|
3
|
-
}
|
|
4
|
-
BaseWalletStrategy.prototype.handleError = function (error, operation) {
|
|
5
|
-
console.error("".concat(operation, " error:"), error);
|
|
6
|
-
if (error instanceof Error) {
|
|
7
|
-
return error;
|
|
8
|
-
}
|
|
9
|
-
return new Error("Failed to ".concat(operation));
|
|
10
|
-
};
|
|
11
|
-
BaseWalletStrategy.prototype.isUserRejection = function (error) {
|
|
12
|
-
var _a;
|
|
13
|
-
if (!error)
|
|
14
|
-
return false;
|
|
15
|
-
var message = ((_a = error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
16
|
-
//4001 - user reject, -32603 internal error
|
|
17
|
-
var errorCodes = [4001, -32603];
|
|
18
|
-
return (message.includes('user rejected') ||
|
|
19
|
-
message.includes('declined') ||
|
|
20
|
-
message.includes('cancelled') ||
|
|
21
|
-
errorCodes.includes(error.code));
|
|
22
|
-
};
|
|
23
|
-
return BaseWalletStrategy;
|
|
24
|
-
}());
|
|
25
|
-
export { BaseWalletStrategy };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { WalletStrategy } from './WalletStrategy';
|
|
2
|
-
export type NetworkType = 'evm' | 'solana';
|
|
3
|
-
export declare class WalletStrategyFactory {
|
|
4
|
-
private static instance;
|
|
5
|
-
private strategies;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): WalletStrategyFactory;
|
|
8
|
-
getStrategy(networkType: NetworkType): WalletStrategy;
|
|
9
|
-
getAllProviders(): {
|
|
10
|
-
id: string;
|
|
11
|
-
type: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
icon?: string;
|
|
14
|
-
}[];
|
|
15
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { EVMWalletStrategy } from './EVMWalletStrategy';
|
|
2
|
-
import { SolanaWalletStrategy } from './SolanaWalletStrategy';
|
|
3
|
-
var WalletStrategyFactory = /** @class */ (function () {
|
|
4
|
-
function WalletStrategyFactory() {
|
|
5
|
-
this.strategies = new Map();
|
|
6
|
-
this.strategies.set('evm', new EVMWalletStrategy());
|
|
7
|
-
this.strategies.set('solana', new SolanaWalletStrategy());
|
|
8
|
-
}
|
|
9
|
-
WalletStrategyFactory.getInstance = function () {
|
|
10
|
-
if (!WalletStrategyFactory.instance) {
|
|
11
|
-
WalletStrategyFactory.instance = new WalletStrategyFactory();
|
|
12
|
-
}
|
|
13
|
-
return WalletStrategyFactory.instance;
|
|
14
|
-
};
|
|
15
|
-
WalletStrategyFactory.prototype.getStrategy = function (networkType) {
|
|
16
|
-
var strategy = this.strategies.get(networkType);
|
|
17
|
-
if (!strategy) {
|
|
18
|
-
throw new Error("No strategy found for network type: ".concat(networkType));
|
|
19
|
-
}
|
|
20
|
-
return strategy;
|
|
21
|
-
};
|
|
22
|
-
WalletStrategyFactory.prototype.getAllProviders = function () {
|
|
23
|
-
var allProviders = [];
|
|
24
|
-
this.strategies.forEach(function (strategy) {
|
|
25
|
-
allProviders.push.apply(allProviders, strategy.getProviders());
|
|
26
|
-
});
|
|
27
|
-
return allProviders;
|
|
28
|
-
};
|
|
29
|
-
return WalletStrategyFactory;
|
|
30
|
-
}());
|
|
31
|
-
export { WalletStrategyFactory };
|
package/utils/wallet/index.d.ts
DELETED
package/utils/wallet/index.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { AddressLookupTableStateDto, TransactionInstructionDto } from './types';
|
|
2
|
-
export type WalletBrowserEventType = WalletBrowserInjectedWalletSelected | WalletBrowserSignRequest | WalletBrowserChainSwitchRequest | WalletBrowserTransferBalanceRequest | WalletBrowserNativeTransferRequest | WalletBrowserNonNativeTransferRequest | WalletBrowserNativeSmartDeposit | WalletBrowserNonNativeSmartDeposit | WalletBrowserDisconnect | WalletBrowserTransactionBatch | WalletBrowserWalletCapabilities | WalletBrowserSolanaTransferWithInstructionsRequest;
|
|
3
|
-
declare const WALLET_BROWSER_EVENT_TYPE_KEYS: readonly ["walletBrowserInjectedWalletSelected", "walletBrowserSignRequest", "walletBrowserChainSwitchRequest", "walletBrowserTransferBalanceRequest", "walletBrowserNativeTransferRequest", "walletBrowserNonNativeTransferRequest", "walletBrowserNativeSmartDeposit", "walletBrowserNonNativeSmartDeposit", "walletBrowserDisconnect", "walletBrowserTransactionBatchRequest", "walletBrowserWalletCapabilities", "walletBrowserSolanaTransferWithInstructionsRequest"];
|
|
4
|
-
export type NetworkType = 'unknown' | 'evm' | 'solana' | 'bitcoin' | 'cardano' | 'tron' | 'avalancheX' | 'tezos' | 'dogecoin' | 'ripple' | 'stellar' | 'litecoin' | 'sui' | 'aptos' | 'tvm';
|
|
5
|
-
export type WalletBrowserEventTypeKeys = (typeof WALLET_BROWSER_EVENT_TYPE_KEYS)[number];
|
|
6
|
-
export declare function isWalletBrowserEventTypeKey(key: string): key is WalletBrowserEventTypeKeys;
|
|
7
|
-
interface WalletBrowserEventBase {
|
|
8
|
-
type: WalletBrowserEventTypeKeys;
|
|
9
|
-
}
|
|
10
|
-
export interface WalletBrowserInjectedWalletSelected extends WalletBrowserEventBase {
|
|
11
|
-
type: 'walletBrowserInjectedWalletSelected';
|
|
12
|
-
payload: {
|
|
13
|
-
integrationName: string;
|
|
14
|
-
networkType?: string;
|
|
15
|
-
targetChainId?: number;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface WalletBrowserSignRequest extends WalletBrowserEventBase {
|
|
19
|
-
type: 'walletBrowserSignRequest';
|
|
20
|
-
payload: {
|
|
21
|
-
address: `0x${string}`;
|
|
22
|
-
message: string;
|
|
23
|
-
walletName?: string;
|
|
24
|
-
networkType?: NetworkType;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export interface WalletBrowserChainSwitchRequest extends WalletBrowserEventBase {
|
|
28
|
-
type: 'walletBrowserChainSwitchRequest';
|
|
29
|
-
payload: {
|
|
30
|
-
chainId: number;
|
|
31
|
-
networkType: NetworkType;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export interface WalletBrowserTransferBalanceRequest extends WalletBrowserEventBase {
|
|
35
|
-
type: 'walletBrowserTransferBalanceRequest';
|
|
36
|
-
payload: {
|
|
37
|
-
account: string;
|
|
38
|
-
chainId: number;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export interface WalletBrowserNativeTransferRequest extends WalletBrowserEventBase {
|
|
42
|
-
type: 'walletBrowserNativeTransferRequest';
|
|
43
|
-
payload: {
|
|
44
|
-
toAddress: string;
|
|
45
|
-
amount: number;
|
|
46
|
-
decimalPlaces: number;
|
|
47
|
-
chainId: number;
|
|
48
|
-
account: string;
|
|
49
|
-
network: string;
|
|
50
|
-
blockhash?: string;
|
|
51
|
-
walletName?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
interface SmartContractPayload {
|
|
55
|
-
address: string;
|
|
56
|
-
abi: string;
|
|
57
|
-
functionName: string;
|
|
58
|
-
args: unknown[];
|
|
59
|
-
account: string;
|
|
60
|
-
value?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface WalletBrowserNonNativeTransferRequest extends WalletBrowserEventBase {
|
|
63
|
-
type: 'walletBrowserNonNativeTransferRequest';
|
|
64
|
-
payload: SmartContractPayload;
|
|
65
|
-
}
|
|
66
|
-
export interface WalletBrowserNativeSmartDeposit extends WalletBrowserEventBase {
|
|
67
|
-
type: 'walletBrowserNativeSmartDeposit';
|
|
68
|
-
payload: SmartContractPayload;
|
|
69
|
-
}
|
|
70
|
-
export interface WalletBrowserNonNativeSmartDeposit extends WalletBrowserEventBase {
|
|
71
|
-
type: 'walletBrowserNonNativeSmartDeposit';
|
|
72
|
-
payload: SmartContractPayload;
|
|
73
|
-
}
|
|
74
|
-
export interface WalletBrowserDisconnect extends WalletBrowserEventBase {
|
|
75
|
-
type: 'walletBrowserDisconnect';
|
|
76
|
-
payload?: {
|
|
77
|
-
networkType?: NetworkType;
|
|
78
|
-
walletName?: string;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
export interface WalletBrowserTransactionBatch extends WalletBrowserEventBase {
|
|
82
|
-
type: 'walletBrowserTransactionBatchRequest';
|
|
83
|
-
payload: {
|
|
84
|
-
version: string;
|
|
85
|
-
from: string;
|
|
86
|
-
chainId: string;
|
|
87
|
-
atomicRequired: boolean;
|
|
88
|
-
calls: {
|
|
89
|
-
to: string;
|
|
90
|
-
value: string;
|
|
91
|
-
data?: string;
|
|
92
|
-
}[];
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
export interface WalletBrowserWalletCapabilities extends WalletBrowserEventBase {
|
|
96
|
-
type: 'walletBrowserWalletCapabilities';
|
|
97
|
-
payload: {
|
|
98
|
-
from: string;
|
|
99
|
-
chainId: string;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
export interface WalletBrowserSolanaTransferWithInstructionsRequest extends WalletBrowserEventBase {
|
|
103
|
-
type: 'walletBrowserSolanaTransferWithInstructionsRequest';
|
|
104
|
-
payload: {
|
|
105
|
-
transactionInstructions: {
|
|
106
|
-
instructions: TransactionInstructionDto[];
|
|
107
|
-
states: AddressLookupTableStateDto[];
|
|
108
|
-
account: string;
|
|
109
|
-
blockhash: string;
|
|
110
|
-
walletName?: string;
|
|
111
|
-
network?: string;
|
|
112
|
-
};
|
|
113
|
-
transferConfig: SmartContractPayload;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var WALLET_BROWSER_EVENT_TYPE_KEYS = [
|
|
2
|
-
'walletBrowserInjectedWalletSelected',
|
|
3
|
-
'walletBrowserSignRequest',
|
|
4
|
-
'walletBrowserChainSwitchRequest',
|
|
5
|
-
'walletBrowserTransferBalanceRequest',
|
|
6
|
-
'walletBrowserNativeTransferRequest',
|
|
7
|
-
'walletBrowserNonNativeTransferRequest',
|
|
8
|
-
'walletBrowserNativeSmartDeposit',
|
|
9
|
-
'walletBrowserNonNativeSmartDeposit',
|
|
10
|
-
'walletBrowserDisconnect',
|
|
11
|
-
'walletBrowserTransactionBatchRequest',
|
|
12
|
-
'walletBrowserWalletCapabilities',
|
|
13
|
-
'walletBrowserSolanaTransferWithInstructionsRequest'
|
|
14
|
-
];
|
|
15
|
-
export function isWalletBrowserEventTypeKey(key) {
|
|
16
|
-
return WALLET_BROWSER_EVENT_TYPE_KEYS.includes(key);
|
|
17
|
-
}
|