@coinbase/agentkit 0.0.0-nightly-20250328174338
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/README.md +827 -0
- package/dist/action-providers/across/acrossActionProvider.d.ts +50 -0
- package/dist/action-providers/across/acrossActionProvider.js +333 -0
- package/dist/action-providers/across/acrossActionProvider.test.d.ts +1 -0
- package/dist/action-providers/across/acrossActionProvider.test.js +391 -0
- package/dist/action-providers/across/constants.d.ts +1 -0
- package/dist/action-providers/across/constants.js +2 -0
- package/dist/action-providers/across/index.d.ts +1 -0
- package/dist/action-providers/across/index.js +17 -0
- package/dist/action-providers/across/schemas.d.ts +36 -0
- package/dist/action-providers/across/schemas.js +46 -0
- package/dist/action-providers/across/utils.d.ts +7 -0
- package/dist/action-providers/across/utils.js +25 -0
- package/dist/action-providers/actionDecorator.d.ts +69 -0
- package/dist/action-providers/actionDecorator.js +96 -0
- package/dist/action-providers/actionProvider.d.ts +48 -0
- package/dist/action-providers/actionProvider.js +62 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.d.ts +55 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.js +173 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.d.ts +1 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.js +131 -0
- package/dist/action-providers/alchemy/index.d.ts +2 -0
- package/dist/action-providers/alchemy/index.js +18 -0
- package/dist/action-providers/alchemy/schemas.d.ts +41 -0
- package/dist/action-providers/alchemy/schemas.js +34 -0
- package/dist/action-providers/allora/alloraActionProvider.d.ts +44 -0
- package/dist/action-providers/allora/alloraActionProvider.js +195 -0
- package/dist/action-providers/allora/alloraActionProvider.test.d.ts +1 -0
- package/dist/action-providers/allora/alloraActionProvider.test.js +109 -0
- package/dist/action-providers/allora/index.d.ts +2 -0
- package/dist/action-providers/allora/index.js +18 -0
- package/dist/action-providers/allora/schemas.d.ts +28 -0
- package/dist/action-providers/allora/schemas.js +30 -0
- package/dist/action-providers/basename/basenameActionProvider.d.ts +30 -0
- package/dist/action-providers/basename/basenameActionProvider.js +109 -0
- package/dist/action-providers/basename/basenameActionProvider.test.d.ts +1 -0
- package/dist/action-providers/basename/basenameActionProvider.test.js +146 -0
- package/dist/action-providers/basename/constants.d.ts +52 -0
- package/dist/action-providers/basename/constants.js +81 -0
- package/dist/action-providers/basename/index.d.ts +2 -0
- package/dist/action-providers/basename/index.js +18 -0
- package/dist/action-providers/basename/schemas.d.ts +14 -0
- package/dist/action-providers/basename/schemas.js +14 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +43 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.js +128 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.test.d.ts +1 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.test.js +146 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.d.ts +58 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.js +224 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.test.d.ts +1 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.test.js +267 -0
- package/dist/action-providers/cdp/constants.d.ts +31 -0
- package/dist/action-providers/cdp/constants.js +34 -0
- package/dist/action-providers/cdp/index.d.ts +3 -0
- package/dist/action-providers/cdp/index.js +19 -0
- package/dist/action-providers/cdp/schemas.d.ts +91 -0
- package/dist/action-providers/cdp/schemas.js +77 -0
- package/dist/action-providers/compound/compoundActionProvider.d.ts +67 -0
- package/dist/action-providers/compound/compoundActionProvider.js +365 -0
- package/dist/action-providers/compound/compoundActionProvider.test.d.ts +1 -0
- package/dist/action-providers/compound/compoundActionProvider.test.js +353 -0
- package/dist/action-providers/compound/constants.d.ts +180 -0
- package/dist/action-providers/compound/constants.js +129 -0
- package/dist/action-providers/compound/index.d.ts +1 -0
- package/dist/action-providers/compound/index.js +17 -0
- package/dist/action-providers/compound/schemas.d.ts +57 -0
- package/dist/action-providers/compound/schemas.js +58 -0
- package/dist/action-providers/compound/utils.d.ts +95 -0
- package/dist/action-providers/compound/utils.js +353 -0
- package/dist/action-providers/customActionProvider.d.ts +30 -0
- package/dist/action-providers/customActionProvider.js +66 -0
- package/dist/action-providers/defillama/constants.d.ts +8 -0
- package/dist/action-providers/defillama/constants.js +11 -0
- package/dist/action-providers/defillama/defillamaActionProvider.d.ts +54 -0
- package/dist/action-providers/defillama/defillamaActionProvider.js +180 -0
- package/dist/action-providers/defillama/defillamaActionProvider.test.d.ts +1 -0
- package/dist/action-providers/defillama/defillamaActionProvider.test.js +114 -0
- package/dist/action-providers/defillama/index.d.ts +1 -0
- package/dist/action-providers/defillama/index.js +17 -0
- package/dist/action-providers/defillama/schemas.d.ts +34 -0
- package/dist/action-providers/defillama/schemas.js +34 -0
- package/dist/action-providers/defillama/types.d.ts +73 -0
- package/dist/action-providers/defillama/types.js +2 -0
- package/dist/action-providers/defillama/utils.d.ts +10 -0
- package/dist/action-providers/defillama/utils.js +87 -0
- package/dist/action-providers/defillama/utils.test.d.ts +1 -0
- package/dist/action-providers/defillama/utils.test.js +124 -0
- package/dist/action-providers/erc20/constants.d.ts +137 -0
- package/dist/action-providers/erc20/constants.js +202 -0
- package/dist/action-providers/erc20/erc20ActionProvider.d.ts +38 -0
- package/dist/action-providers/erc20/erc20ActionProvider.js +142 -0
- package/dist/action-providers/erc20/erc20ActionProvider.test.d.ts +1 -0
- package/dist/action-providers/erc20/erc20ActionProvider.test.js +131 -0
- package/dist/action-providers/erc20/index.d.ts +1 -0
- package/dist/action-providers/erc20/index.js +17 -0
- package/dist/action-providers/erc20/schemas.d.ts +27 -0
- package/dist/action-providers/erc20/schemas.js +26 -0
- package/dist/action-providers/erc721/constants.d.ts +232 -0
- package/dist/action-providers/erc721/constants.js +298 -0
- package/dist/action-providers/erc721/erc721ActionProvider.d.ts +46 -0
- package/dist/action-providers/erc721/erc721ActionProvider.js +164 -0
- package/dist/action-providers/erc721/erc721ActionProvider.test.d.ts +1 -0
- package/dist/action-providers/erc721/erc721ActionProvider.test.js +137 -0
- package/dist/action-providers/erc721/index.d.ts +1 -0
- package/dist/action-providers/erc721/index.js +17 -0
- package/dist/action-providers/erc721/schemas.d.ts +46 -0
- package/dist/action-providers/erc721/schemas.js +44 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.d.ts +57 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.js +142 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.test.d.ts +1 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.test.js +151 -0
- package/dist/action-providers/farcaster/index.d.ts +2 -0
- package/dist/action-providers/farcaster/index.js +18 -0
- package/dist/action-providers/farcaster/schemas.d.ts +15 -0
- package/dist/action-providers/farcaster/schemas.js +20 -0
- package/dist/action-providers/index.d.ts +24 -0
- package/dist/action-providers/index.js +40 -0
- package/dist/action-providers/jupiter/index.d.ts +1 -0
- package/dist/action-providers/jupiter/index.js +17 -0
- package/dist/action-providers/jupiter/jupiterActionProvider.d.ts +36 -0
- package/dist/action-providers/jupiter/jupiterActionProvider.js +115 -0
- package/dist/action-providers/jupiter/jupiterActionProvider.test.d.ts +1 -0
- package/dist/action-providers/jupiter/jupiterActionProvider.test.js +146 -0
- package/dist/action-providers/jupiter/schemas.d.ts +20 -0
- package/dist/action-providers/jupiter/schemas.js +20 -0
- package/dist/action-providers/messari/constants.d.ts +17 -0
- package/dist/action-providers/messari/constants.js +20 -0
- package/dist/action-providers/messari/index.d.ts +5 -0
- package/dist/action-providers/messari/index.js +21 -0
- package/dist/action-providers/messari/messariActionProvider.d.ts +42 -0
- package/dist/action-providers/messari/messariActionProvider.js +128 -0
- package/dist/action-providers/messari/messariActionProvider.test.d.ts +1 -0
- package/dist/action-providers/messari/messariActionProvider.test.js +152 -0
- package/dist/action-providers/messari/schemas.d.ts +11 -0
- package/dist/action-providers/messari/schemas.js +16 -0
- package/dist/action-providers/messari/types.d.ts +40 -0
- package/dist/action-providers/messari/types.js +2 -0
- package/dist/action-providers/messari/utils.d.ts +22 -0
- package/dist/action-providers/messari/utils.js +65 -0
- package/dist/action-providers/moonwell/constants.d.ts +78 -0
- package/dist/action-providers/moonwell/constants.js +111 -0
- package/dist/action-providers/moonwell/index.d.ts +1 -0
- package/dist/action-providers/moonwell/index.js +5 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.d.ts +39 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.js +249 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.test.d.ts +1 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.test.js +455 -0
- package/dist/action-providers/moonwell/schemas.d.ts +30 -0
- package/dist/action-providers/moonwell/schemas.js +39 -0
- package/dist/action-providers/morpho/constants.d.ts +16 -0
- package/dist/action-providers/morpho/constants.js +27 -0
- package/dist/action-providers/morpho/index.d.ts +2 -0
- package/dist/action-providers/morpho/index.js +18 -0
- package/dist/action-providers/morpho/morphoActionProvider.d.ts +39 -0
- package/dist/action-providers/morpho/morphoActionProvider.js +154 -0
- package/dist/action-providers/morpho/morphoActionProvider.test.d.ts +1 -0
- package/dist/action-providers/morpho/morphoActionProvider.test.js +128 -0
- package/dist/action-providers/morpho/schemas.d.ts +36 -0
- package/dist/action-providers/morpho/schemas.js +47 -0
- package/dist/action-providers/opensea/index.d.ts +1 -0
- package/dist/action-providers/opensea/index.js +17 -0
- package/dist/action-providers/opensea/openseaActionProvider.d.ts +59 -0
- package/dist/action-providers/opensea/openseaActionProvider.js +146 -0
- package/dist/action-providers/opensea/openseaActionProvider.test.d.ts +1 -0
- package/dist/action-providers/opensea/openseaActionProvider.test.js +201 -0
- package/dist/action-providers/opensea/schemas.d.ts +30 -0
- package/dist/action-providers/opensea/schemas.js +33 -0
- package/dist/action-providers/opensea/utils.d.ts +12 -0
- package/dist/action-providers/opensea/utils.js +47 -0
- package/dist/action-providers/pyth/index.d.ts +2 -0
- package/dist/action-providers/pyth/index.js +18 -0
- package/dist/action-providers/pyth/pythActionProvider.d.ts +33 -0
- package/dist/action-providers/pyth/pythActionProvider.js +121 -0
- package/dist/action-providers/pyth/pythActionProvider.test.d.ts +1 -0
- package/dist/action-providers/pyth/pythActionProvider.test.js +113 -0
- package/dist/action-providers/pyth/schemas.d.ts +21 -0
- package/dist/action-providers/pyth/schemas.js +20 -0
- package/dist/action-providers/spl/index.d.ts +1 -0
- package/dist/action-providers/spl/index.js +17 -0
- package/dist/action-providers/spl/schemas.d.ts +30 -0
- package/dist/action-providers/spl/schemas.js +26 -0
- package/dist/action-providers/spl/splActionProvider.d.ts +45 -0
- package/dist/action-providers/spl/splActionProvider.js +173 -0
- package/dist/action-providers/spl/splActionProvider.test.d.ts +1 -0
- package/dist/action-providers/spl/splActionProvider.test.js +300 -0
- package/dist/action-providers/twitter/index.d.ts +2 -0
- package/dist/action-providers/twitter/index.js +18 -0
- package/dist/action-providers/twitter/schemas.d.ts +38 -0
- package/dist/action-providers/twitter/schemas.js +44 -0
- package/dist/action-providers/twitter/twitterActionProvider.d.ts +82 -0
- package/dist/action-providers/twitter/twitterActionProvider.js +204 -0
- package/dist/action-providers/twitter/twitterActionProvider.test.d.ts +1 -0
- package/dist/action-providers/twitter/twitterActionProvider.test.js +185 -0
- package/dist/action-providers/wallet/index.d.ts +1 -0
- package/dist/action-providers/wallet/index.js +17 -0
- package/dist/action-providers/wallet/schemas.d.ts +19 -0
- package/dist/action-providers/wallet/schemas.js +19 -0
- package/dist/action-providers/wallet/walletActionProvider.d.ts +44 -0
- package/dist/action-providers/wallet/walletActionProvider.js +140 -0
- package/dist/action-providers/wallet/walletActionProvider.test.d.ts +1 -0
- package/dist/action-providers/wallet/walletActionProvider.test.js +194 -0
- package/dist/action-providers/weth/constants.d.ts +19 -0
- package/dist/action-providers/weth/constants.js +29 -0
- package/dist/action-providers/weth/index.d.ts +1 -0
- package/dist/action-providers/weth/index.js +17 -0
- package/dist/action-providers/weth/schemas.d.ts +8 -0
- package/dist/action-providers/weth/schemas.js +10 -0
- package/dist/action-providers/weth/wethActionProvider.d.ts +30 -0
- package/dist/action-providers/weth/wethActionProvider.js +89 -0
- package/dist/action-providers/weth/wethActionProvider.test.d.ts +1 -0
- package/dist/action-providers/weth/wethActionProvider.test.js +92 -0
- package/dist/action-providers/wow/constants.d.ts +15 -0
- package/dist/action-providers/wow/constants.js +844 -0
- package/dist/action-providers/wow/index.d.ts +2 -0
- package/dist/action-providers/wow/index.js +18 -0
- package/dist/action-providers/wow/schemas.d.ts +43 -0
- package/dist/action-providers/wow/schemas.js +47 -0
- package/dist/action-providers/wow/uniswap/constants.d.ts +3 -0
- package/dist/action-providers/wow/uniswap/constants.js +100 -0
- package/dist/action-providers/wow/uniswap/utils.d.ts +82 -0
- package/dist/action-providers/wow/uniswap/utils.js +226 -0
- package/dist/action-providers/wow/utils.d.ts +27 -0
- package/dist/action-providers/wow/utils.js +63 -0
- package/dist/action-providers/wow/wowActionProvider.d.ts +46 -0
- package/dist/action-providers/wow/wowActionProvider.js +223 -0
- package/dist/action-providers/wow/wowActionProvider.test.d.ts +1 -0
- package/dist/action-providers/wow/wowActionProvider.test.js +291 -0
- package/dist/agentkit.d.ts +44 -0
- package/dist/agentkit.js +68 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.js +17 -0
- package/dist/analytics/sendAnalyticsEvent.d.ts +31 -0
- package/dist/analytics/sendAnalyticsEvent.js +52 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/network/index.d.ts +3 -0
- package/dist/network/index.js +19 -0
- package/dist/network/network.d.ts +20 -0
- package/dist/network/network.js +86 -0
- package/dist/network/svm.d.ts +15 -0
- package/dist/network/svm.js +38 -0
- package/dist/network/types.d.ts +17 -0
- package/dist/network/types.js +2 -0
- package/dist/utils.d.ts +22 -0
- package/dist/utils.js +57 -0
- package/dist/utils.test.d.ts +1 -0
- package/dist/utils.test.js +50 -0
- package/dist/wallet-providers/cdpWalletProvider.d.ts +246 -0
- package/dist/wallet-providers/cdpWalletProvider.js +421 -0
- package/dist/wallet-providers/cdpWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/cdpWalletProvider.test.js +701 -0
- package/dist/wallet-providers/evmWalletProvider.d.ts +51 -0
- package/dist/wallet-providers/evmWalletProvider.js +14 -0
- package/dist/wallet-providers/evmWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/evmWalletProvider.test.js +56 -0
- package/dist/wallet-providers/index.d.ts +10 -0
- package/dist/wallet-providers/index.js +26 -0
- package/dist/wallet-providers/privyEvmWalletProvider.d.ts +55 -0
- package/dist/wallet-providers/privyEvmWalletProvider.js +140 -0
- package/dist/wallet-providers/privyEvmWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/privyEvmWalletProvider.test.js +331 -0
- package/dist/wallet-providers/privyShared.d.ts +40 -0
- package/dist/wallet-providers/privyShared.js +49 -0
- package/dist/wallet-providers/privySvmWalletProvider.d.ts +128 -0
- package/dist/wallet-providers/privySvmWalletProvider.js +212 -0
- package/dist/wallet-providers/privySvmWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/privySvmWalletProvider.test.js +310 -0
- package/dist/wallet-providers/privyWalletProvider.d.ts +35 -0
- package/dist/wallet-providers/privyWalletProvider.js +39 -0
- package/dist/wallet-providers/privyWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/privyWalletProvider.test.js +124 -0
- package/dist/wallet-providers/smartWalletProvider.d.ts +177 -0
- package/dist/wallet-providers/smartWalletProvider.js +303 -0
- package/dist/wallet-providers/smartWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/smartWalletProvider.test.js +388 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +143 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.js +280 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +218 -0
- package/dist/wallet-providers/svmWalletProvider.d.ts +56 -0
- package/dist/wallet-providers/svmWalletProvider.js +13 -0
- package/dist/wallet-providers/svmWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/svmWalletProvider.test.js +55 -0
- package/dist/wallet-providers/viemWalletProvider.d.ts +103 -0
- package/dist/wallet-providers/viemWalletProvider.js +206 -0
- package/dist/wallet-providers/viemWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/viemWalletProvider.test.js +338 -0
- package/dist/wallet-providers/walletProvider.d.ts +48 -0
- package/dist/wallet-providers/walletProvider.js +41 -0
- package/dist/wallet-providers/walletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/walletProvider.test.js +103 -0
- package/package.json +83 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const coinbaseSdk = __importStar(require("@coinbase/coinbase-sdk"));
|
|
37
|
+
global.fetch = jest.fn(() => Promise.resolve({
|
|
38
|
+
ok: true,
|
|
39
|
+
json: () => Promise.resolve({}),
|
|
40
|
+
}));
|
|
41
|
+
jest.mock("../analytics", () => ({
|
|
42
|
+
sendAnalyticsEvent: jest.fn().mockImplementation(() => Promise.resolve()),
|
|
43
|
+
}));
|
|
44
|
+
// =========================================================
|
|
45
|
+
// constants
|
|
46
|
+
// =========================================================
|
|
47
|
+
const MOCK_ADDRESS = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e";
|
|
48
|
+
const MOCK_CHAIN_ID = "1";
|
|
49
|
+
const MOCK_NETWORK_ID = "mainnet";
|
|
50
|
+
const MOCK_TRANSACTION_HASH = "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba";
|
|
51
|
+
const MOCK_BALANCE = BigInt(1000000000000000000);
|
|
52
|
+
const mockPublicClient = {
|
|
53
|
+
waitForTransactionReceipt: jest.fn(),
|
|
54
|
+
readContract: jest.fn(),
|
|
55
|
+
};
|
|
56
|
+
var UserOperationStatus;
|
|
57
|
+
(function (UserOperationStatus) {
|
|
58
|
+
UserOperationStatus["CREATED"] = "created";
|
|
59
|
+
UserOperationStatus["PENDING"] = "pending";
|
|
60
|
+
UserOperationStatus["COMPLETE"] = "complete";
|
|
61
|
+
})(UserOperationStatus || (UserOperationStatus = {}));
|
|
62
|
+
// =========================================================
|
|
63
|
+
// mocks
|
|
64
|
+
// =========================================================
|
|
65
|
+
jest.mock("viem", () => {
|
|
66
|
+
return {
|
|
67
|
+
createPublicClient: jest.fn(() => mockPublicClient),
|
|
68
|
+
http: jest.fn(),
|
|
69
|
+
parseEther: jest.fn((_value) => MOCK_BALANCE),
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
jest.mock("../network", () => {
|
|
73
|
+
return {
|
|
74
|
+
NETWORK_ID_TO_CHAIN_ID: {
|
|
75
|
+
mainnet: "1",
|
|
76
|
+
"base-sepolia": "84532",
|
|
77
|
+
},
|
|
78
|
+
NETWORK_ID_TO_VIEM_CHAIN: {
|
|
79
|
+
mainnet: {},
|
|
80
|
+
"base-sepolia": {},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
jest.mock("@coinbase/coinbase-sdk", () => {
|
|
85
|
+
return {
|
|
86
|
+
CHAIN_ID_TO_NETWORK_ID: {
|
|
87
|
+
"1": "mainnet",
|
|
88
|
+
"84532": "base-sepolia",
|
|
89
|
+
},
|
|
90
|
+
NETWORK_ID_TO_CHAIN_ID: {
|
|
91
|
+
mainnet: "1",
|
|
92
|
+
"base-sepolia": "84532",
|
|
93
|
+
},
|
|
94
|
+
NETWORK_ID_TO_VIEM_CHAIN: {
|
|
95
|
+
mainnet: {},
|
|
96
|
+
"base-sepolia": {},
|
|
97
|
+
},
|
|
98
|
+
Coinbase: {
|
|
99
|
+
configure: jest.fn(),
|
|
100
|
+
configureFromJson: jest.fn(),
|
|
101
|
+
networks: {
|
|
102
|
+
BaseSepolia: "base-sepolia",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
waitForUserOperation: jest.fn(),
|
|
106
|
+
createSmartWallet: jest.fn(),
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
// =========================================================
|
|
110
|
+
// tests
|
|
111
|
+
// =========================================================
|
|
112
|
+
describe("SmartWalletProvider", () => {
|
|
113
|
+
let provider;
|
|
114
|
+
let mockNetworkScopedWallet;
|
|
115
|
+
let mockWaitForUserOperation;
|
|
116
|
+
beforeEach(() => {
|
|
117
|
+
jest.clearAllMocks();
|
|
118
|
+
const mockGetBalance = jest.fn();
|
|
119
|
+
mockGetBalance.mockResolvedValue(MOCK_BALANCE);
|
|
120
|
+
const mockSendTransaction = jest.fn();
|
|
121
|
+
mockSendTransaction.mockResolvedValue(MOCK_TRANSACTION_HASH);
|
|
122
|
+
const mockSendUserOperation = jest.fn();
|
|
123
|
+
mockNetworkScopedWallet = {
|
|
124
|
+
address: MOCK_ADDRESS,
|
|
125
|
+
getBalance: mockGetBalance,
|
|
126
|
+
sendTransaction: mockSendTransaction,
|
|
127
|
+
sendUserOperation: mockSendUserOperation,
|
|
128
|
+
};
|
|
129
|
+
const mockUserOperationWait = jest.fn();
|
|
130
|
+
mockUserOperationWait.mockResolvedValue({
|
|
131
|
+
status: UserOperationStatus.COMPLETE,
|
|
132
|
+
transactionHash: MOCK_TRANSACTION_HASH,
|
|
133
|
+
});
|
|
134
|
+
const mockUserOperation = {
|
|
135
|
+
hash: MOCK_TRANSACTION_HASH,
|
|
136
|
+
wait: mockUserOperationWait,
|
|
137
|
+
};
|
|
138
|
+
mockNetworkScopedWallet.sendUserOperation.mockResolvedValue(mockUserOperation);
|
|
139
|
+
mockPublicClient.waitForTransactionReceipt.mockResolvedValue({
|
|
140
|
+
transactionHash: MOCK_TRANSACTION_HASH,
|
|
141
|
+
});
|
|
142
|
+
mockPublicClient.readContract.mockResolvedValue("mock_result");
|
|
143
|
+
provider = {
|
|
144
|
+
sendTransaction: jest.fn(),
|
|
145
|
+
sendUserOperation: jest.fn(),
|
|
146
|
+
waitForTransactionReceipt: jest.fn(),
|
|
147
|
+
signMessage: jest.fn(),
|
|
148
|
+
signTypedData: jest.fn(),
|
|
149
|
+
signTransaction: jest.fn(),
|
|
150
|
+
getAddress: jest.fn(),
|
|
151
|
+
getNetwork: jest.fn(),
|
|
152
|
+
getName: jest.fn(),
|
|
153
|
+
getBalance: jest.fn(),
|
|
154
|
+
readContract: jest.fn(),
|
|
155
|
+
nativeTransfer: jest.fn(),
|
|
156
|
+
_smartWallet: mockNetworkScopedWallet,
|
|
157
|
+
};
|
|
158
|
+
provider.getAddress.mockReturnValue(MOCK_ADDRESS);
|
|
159
|
+
provider.getNetwork.mockReturnValue({
|
|
160
|
+
protocolFamily: "evm",
|
|
161
|
+
networkId: MOCK_NETWORK_ID,
|
|
162
|
+
chainId: MOCK_CHAIN_ID,
|
|
163
|
+
});
|
|
164
|
+
provider.getName.mockReturnValue("smart_wallet_provider");
|
|
165
|
+
provider.getBalance.mockResolvedValue(MOCK_BALANCE);
|
|
166
|
+
provider.sendTransaction.mockImplementation(async (tx) => {
|
|
167
|
+
const _result = await mockNetworkScopedWallet.sendUserOperation({ calls: [tx] });
|
|
168
|
+
const waitResult = await _result.wait();
|
|
169
|
+
if (waitResult.status === "failed") {
|
|
170
|
+
throw new Error(`Transaction failed with status ${waitResult.status}`);
|
|
171
|
+
}
|
|
172
|
+
return _result.hash;
|
|
173
|
+
});
|
|
174
|
+
provider.sendUserOperation.mockImplementation(async (op) => {
|
|
175
|
+
const _result = await mockNetworkScopedWallet.sendUserOperation(op);
|
|
176
|
+
return _result.hash;
|
|
177
|
+
});
|
|
178
|
+
provider.waitForTransactionReceipt.mockImplementation((hash) => mockPublicClient.waitForTransactionReceipt({ hash }));
|
|
179
|
+
provider.readContract.mockImplementation(async (params) => {
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
+
return mockPublicClient.readContract(params);
|
|
182
|
+
});
|
|
183
|
+
provider.nativeTransfer.mockImplementation(async (to, _value) => {
|
|
184
|
+
await mockNetworkScopedWallet.sendUserOperation({
|
|
185
|
+
calls: [
|
|
186
|
+
{
|
|
187
|
+
to,
|
|
188
|
+
value: BigInt(1000000000000000000),
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
});
|
|
192
|
+
return MOCK_TRANSACTION_HASH;
|
|
193
|
+
});
|
|
194
|
+
const notImplementedError = new Error("Not implemented");
|
|
195
|
+
provider.signMessage.mockRejectedValue(notImplementedError);
|
|
196
|
+
provider.signTypedData.mockRejectedValue(notImplementedError);
|
|
197
|
+
provider.signTransaction.mockRejectedValue(notImplementedError);
|
|
198
|
+
mockWaitForUserOperation = jest.fn();
|
|
199
|
+
mockWaitForUserOperation.mockImplementation((operation) => {
|
|
200
|
+
return operation.wait();
|
|
201
|
+
});
|
|
202
|
+
jest
|
|
203
|
+
.spyOn(coinbaseSdk, "waitForUserOperation")
|
|
204
|
+
.mockImplementation(mockWaitForUserOperation);
|
|
205
|
+
});
|
|
206
|
+
// =========================================================
|
|
207
|
+
// transaction operations
|
|
208
|
+
// =========================================================
|
|
209
|
+
describe("transaction operations", () => {
|
|
210
|
+
it("should send transactions", async () => {
|
|
211
|
+
const transaction = {
|
|
212
|
+
to: "0x1234567890123456789012345678901234567890",
|
|
213
|
+
value: BigInt(1000000000000000000),
|
|
214
|
+
};
|
|
215
|
+
const txHash = await provider.sendTransaction(transaction);
|
|
216
|
+
expect(txHash).toBe(MOCK_TRANSACTION_HASH);
|
|
217
|
+
expect(mockNetworkScopedWallet.sendUserOperation).toHaveBeenCalled();
|
|
218
|
+
});
|
|
219
|
+
it("should send a user operation", async () => {
|
|
220
|
+
const calls = [
|
|
221
|
+
{
|
|
222
|
+
to: "0x1234567890123456789012345678901234567890",
|
|
223
|
+
data: "0xabcdef",
|
|
224
|
+
value: 0n,
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
const txHash = await provider.sendUserOperation({ calls });
|
|
228
|
+
expect(txHash).toBe(MOCK_TRANSACTION_HASH);
|
|
229
|
+
expect(mockNetworkScopedWallet.sendUserOperation).toHaveBeenCalledWith({ calls });
|
|
230
|
+
});
|
|
231
|
+
it("should wait for transaction receipts", async () => {
|
|
232
|
+
await provider.waitForTransactionReceipt(MOCK_TRANSACTION_HASH);
|
|
233
|
+
expect(mockPublicClient.waitForTransactionReceipt).toHaveBeenCalled();
|
|
234
|
+
});
|
|
235
|
+
it("should handle transaction failures", async () => {
|
|
236
|
+
mockWaitForUserOperation.mockRejectedValueOnce(new Error("Failed to send transaction"));
|
|
237
|
+
mockNetworkScopedWallet.sendUserOperation.mockRejectedValueOnce(new Error("Failed to send transaction"));
|
|
238
|
+
await expect(provider.sendTransaction({
|
|
239
|
+
to: MOCK_ADDRESS,
|
|
240
|
+
value: MOCK_BALANCE,
|
|
241
|
+
})).rejects.toThrow("Failed to send transaction");
|
|
242
|
+
});
|
|
243
|
+
it("should handle network errors in transactions", async () => {
|
|
244
|
+
mockNetworkScopedWallet.sendUserOperation.mockRejectedValueOnce(new Error("Network connection error"));
|
|
245
|
+
await expect(provider.sendTransaction({
|
|
246
|
+
to: MOCK_ADDRESS,
|
|
247
|
+
value: MOCK_BALANCE,
|
|
248
|
+
})).rejects.toThrow("Network connection error");
|
|
249
|
+
});
|
|
250
|
+
it("should handle invalid address errors", async () => {
|
|
251
|
+
mockNetworkScopedWallet.sendUserOperation.mockRejectedValueOnce(new Error("Invalid address format"));
|
|
252
|
+
const invalidAddressHex = "0xinvalid";
|
|
253
|
+
await expect(provider.sendTransaction({
|
|
254
|
+
to: invalidAddressHex,
|
|
255
|
+
value: MOCK_BALANCE,
|
|
256
|
+
})).rejects.toThrow("Invalid address format");
|
|
257
|
+
});
|
|
258
|
+
it("should handle receipt retrieval failures", async () => {
|
|
259
|
+
mockPublicClient.waitForTransactionReceipt.mockRejectedValueOnce(new Error("Receipt retrieval failed"));
|
|
260
|
+
await expect(provider.waitForTransactionReceipt(MOCK_TRANSACTION_HASH)).rejects.toThrow("Receipt retrieval failed");
|
|
261
|
+
});
|
|
262
|
+
it("should handle operation failures when sending transactions", async () => {
|
|
263
|
+
const mockUserOperationWait = jest.fn();
|
|
264
|
+
mockUserOperationWait.mockResolvedValue({
|
|
265
|
+
status: "failed",
|
|
266
|
+
transactionHash: MOCK_TRANSACTION_HASH,
|
|
267
|
+
});
|
|
268
|
+
const failedOperation = {
|
|
269
|
+
hash: MOCK_TRANSACTION_HASH,
|
|
270
|
+
wait: mockUserOperationWait,
|
|
271
|
+
};
|
|
272
|
+
mockNetworkScopedWallet.sendUserOperation.mockResolvedValueOnce(failedOperation);
|
|
273
|
+
const transaction = {
|
|
274
|
+
to: "0x1234567890123456789012345678901234567890",
|
|
275
|
+
value: BigInt(1000000000000000000),
|
|
276
|
+
};
|
|
277
|
+
await expect(provider.sendTransaction(transaction)).rejects.toThrow("Transaction failed with status failed");
|
|
278
|
+
});
|
|
279
|
+
it("should handle exceptions when sending user operations", async () => {
|
|
280
|
+
mockNetworkScopedWallet.sendUserOperation.mockRejectedValueOnce(new Error("Failed to send"));
|
|
281
|
+
const calls = [
|
|
282
|
+
{
|
|
283
|
+
to: "0x1234567890123456789012345678901234567890",
|
|
284
|
+
data: "0xabcdef",
|
|
285
|
+
value: BigInt(0),
|
|
286
|
+
},
|
|
287
|
+
];
|
|
288
|
+
await expect(provider.sendUserOperation({ calls })).rejects.toThrow("Failed to send");
|
|
289
|
+
});
|
|
290
|
+
it("should handle send user operation timeout", async () => {
|
|
291
|
+
mockNetworkScopedWallet.sendUserOperation.mockRejectedValueOnce(new Error("User operation timed out"));
|
|
292
|
+
const calls = [
|
|
293
|
+
{
|
|
294
|
+
to: "0x1234567890123456789012345678901234567890",
|
|
295
|
+
data: "0xabcdef",
|
|
296
|
+
value: 0n,
|
|
297
|
+
},
|
|
298
|
+
];
|
|
299
|
+
await expect(provider.sendUserOperation({ calls })).rejects.toThrow("User operation timed out");
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
// =========================================================
|
|
303
|
+
// native token transfer operations
|
|
304
|
+
// =========================================================
|
|
305
|
+
describe("native token operations", () => {
|
|
306
|
+
it("should transfer native tokens", async () => {
|
|
307
|
+
const to = "0x1234567890123456789012345678901234567890";
|
|
308
|
+
const value = "1";
|
|
309
|
+
const txHash = await provider.nativeTransfer(to, value);
|
|
310
|
+
expect(mockNetworkScopedWallet.sendUserOperation).toHaveBeenCalled();
|
|
311
|
+
expect(txHash).toBe(MOCK_TRANSACTION_HASH);
|
|
312
|
+
});
|
|
313
|
+
it("should handle operation failures when transferring native tokens", async () => {
|
|
314
|
+
provider.nativeTransfer.mockRejectedValueOnce(new Error("Transfer failed with status failed"));
|
|
315
|
+
const to = "0x1234567890123456789012345678901234567890";
|
|
316
|
+
const value = "1";
|
|
317
|
+
await expect(provider.nativeTransfer(to, value)).rejects.toThrow("Transfer failed with status failed");
|
|
318
|
+
});
|
|
319
|
+
it("should handle invalid address format in native transfer", async () => {
|
|
320
|
+
provider.nativeTransfer.mockRejectedValueOnce(new Error("Invalid address format"));
|
|
321
|
+
const invalidAddress = "not_a_valid_address";
|
|
322
|
+
await expect(provider.nativeTransfer(invalidAddress, "1")).rejects.toThrow("Invalid address format");
|
|
323
|
+
});
|
|
324
|
+
it("should handle network errors in native token transfers", async () => {
|
|
325
|
+
provider.nativeTransfer.mockRejectedValueOnce(new Error("Network error"));
|
|
326
|
+
await expect(provider.nativeTransfer("0x1234567890123456789012345678901234567890", "1")).rejects.toThrow("Network error");
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
// =========================================================
|
|
330
|
+
// contract interaction methods
|
|
331
|
+
// =========================================================
|
|
332
|
+
describe("contract interactions", () => {
|
|
333
|
+
it("should read from contracts", async () => {
|
|
334
|
+
const result = await provider.readContract({
|
|
335
|
+
address: "0x1234567890123456789012345678901234567890",
|
|
336
|
+
abi: [],
|
|
337
|
+
functionName: "balanceOf",
|
|
338
|
+
args: [MOCK_ADDRESS],
|
|
339
|
+
});
|
|
340
|
+
expect(result).toBe("mock_result");
|
|
341
|
+
expect(mockPublicClient.readContract).toHaveBeenCalled();
|
|
342
|
+
});
|
|
343
|
+
it("should handle errors in contract reads", async () => {
|
|
344
|
+
mockPublicClient.readContract.mockRejectedValueOnce(new Error("Contract read failed"));
|
|
345
|
+
await expect(provider.readContract({
|
|
346
|
+
address: "0x1234567890123456789012345678901234567890",
|
|
347
|
+
abi: [],
|
|
348
|
+
functionName: "balanceOf",
|
|
349
|
+
args: [MOCK_ADDRESS],
|
|
350
|
+
})).rejects.toThrow("Contract read failed");
|
|
351
|
+
});
|
|
352
|
+
it("should handle read contract with invalid ABI", async () => {
|
|
353
|
+
const invalidAbi = "not_an_abi";
|
|
354
|
+
const params = {
|
|
355
|
+
address: "0x1234567890123456789012345678901234567890",
|
|
356
|
+
abi: invalidAbi,
|
|
357
|
+
functionName: "balanceOf",
|
|
358
|
+
args: ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e"],
|
|
359
|
+
};
|
|
360
|
+
mockPublicClient.readContract.mockImplementationOnce(() => {
|
|
361
|
+
throw new TypeError("Invalid ABI format");
|
|
362
|
+
});
|
|
363
|
+
await expect(provider.readContract(params)).rejects.toThrow("Invalid ABI format");
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
// =========================================================
|
|
367
|
+
// signing methods (unsupported operations)
|
|
368
|
+
// =========================================================
|
|
369
|
+
describe("unsupported operations", () => {
|
|
370
|
+
it("should throw error on sign message", async () => {
|
|
371
|
+
await expect(provider.signMessage("test")).rejects.toThrow("Not implemented");
|
|
372
|
+
});
|
|
373
|
+
it("should throw error on sign typed data", async () => {
|
|
374
|
+
await expect(provider.signTypedData({
|
|
375
|
+
domain: {},
|
|
376
|
+
types: {},
|
|
377
|
+
primaryType: "",
|
|
378
|
+
message: {},
|
|
379
|
+
})).rejects.toThrow("Not implemented");
|
|
380
|
+
});
|
|
381
|
+
it("should throw error on sign transaction", async () => {
|
|
382
|
+
await expect(provider.signTransaction({
|
|
383
|
+
to: MOCK_ADDRESS,
|
|
384
|
+
value: MOCK_BALANCE,
|
|
385
|
+
})).rejects.toThrow("Not implemented");
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { SvmWalletProvider } from "./svmWalletProvider";
|
|
2
|
+
import { Network } from "../network";
|
|
3
|
+
import { Connection, PublicKey, VersionedTransaction, RpcResponseAndContext, SignatureResult, SignatureStatus, SignatureStatusConfig } from "@solana/web3.js";
|
|
4
|
+
import { SOLANA_CLUSTER, SOLANA_NETWORK_ID } from "../network/svm";
|
|
5
|
+
/**
|
|
6
|
+
* SolanaKeypairWalletProvider is a wallet provider that uses a local Solana keypair.
|
|
7
|
+
*
|
|
8
|
+
* @augments SvmWalletProvider
|
|
9
|
+
*/
|
|
10
|
+
export declare class SolanaKeypairWalletProvider extends SvmWalletProvider {
|
|
11
|
+
#private;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new SolanaKeypairWalletProvider
|
|
14
|
+
*
|
|
15
|
+
* @param args - Configuration arguments
|
|
16
|
+
* @param args.keypair - Either a Uint8Array or a base58 encoded string representing a 32-byte secret key
|
|
17
|
+
* @param args.rpcUrl - URL of the Solana RPC endpoint
|
|
18
|
+
* @param args.genesisHash - The genesis hash of the network
|
|
19
|
+
*/
|
|
20
|
+
constructor({ keypair, rpcUrl, genesisHash, }: {
|
|
21
|
+
keypair: Uint8Array | string;
|
|
22
|
+
rpcUrl: string;
|
|
23
|
+
genesisHash: string;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Get the default RPC URL for a Solana cluster
|
|
27
|
+
*
|
|
28
|
+
* @param cluster - The cluster to get the RPC URL for
|
|
29
|
+
* @returns The RPC URL for the cluster
|
|
30
|
+
*/
|
|
31
|
+
static urlForCluster(cluster: SOLANA_CLUSTER): string;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new SolanaKeypairWalletProvider from an SVM networkId and a keypair
|
|
34
|
+
*
|
|
35
|
+
* @param networkId - The SVM networkId
|
|
36
|
+
* @param keypair - Either a Uint8Array or a base58 encoded string representing a 32-byte secret key
|
|
37
|
+
* @returns The new SolanaKeypairWalletProvider
|
|
38
|
+
*/
|
|
39
|
+
static fromNetwork<T extends SolanaKeypairWalletProvider>(networkId: SOLANA_NETWORK_ID, keypair: Uint8Array | string): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new SolanaKeypairWalletProvider from an RPC URL and a keypair
|
|
42
|
+
*
|
|
43
|
+
* @param rpcUrl - The URL of the Solana RPC endpoint
|
|
44
|
+
* @param keypair - Either a Uint8Array or a base58 encoded string representing a 32-byte secret key
|
|
45
|
+
* @returns The new SolanaKeypairWalletProvider
|
|
46
|
+
*/
|
|
47
|
+
static fromRpcUrl<T extends SolanaKeypairWalletProvider>(rpcUrl: string, keypair: Uint8Array | string): Promise<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new SolanaKeypairWalletProvider from a Connection and a keypair
|
|
50
|
+
*
|
|
51
|
+
* @param connection - The Connection to use
|
|
52
|
+
* @param keypair - Either a Uint8Array or a base58 encoded string representing a 32-byte secret key
|
|
53
|
+
* @returns The new SolanaKeypairWalletProvider
|
|
54
|
+
*/
|
|
55
|
+
static fromConnection<T extends SolanaKeypairWalletProvider>(connection: Connection, keypair: Uint8Array | string): Promise<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the connection instance
|
|
58
|
+
*
|
|
59
|
+
* @returns The Solana connection instance
|
|
60
|
+
*/
|
|
61
|
+
getConnection(): Connection;
|
|
62
|
+
/**
|
|
63
|
+
* Get the public key of the wallet
|
|
64
|
+
*
|
|
65
|
+
* @returns The wallet's public key
|
|
66
|
+
*/
|
|
67
|
+
getPublicKey(): PublicKey;
|
|
68
|
+
/**
|
|
69
|
+
* Get the address of the wallet
|
|
70
|
+
*
|
|
71
|
+
* @returns The base58 encoded address of the wallet
|
|
72
|
+
*/
|
|
73
|
+
getAddress(): string;
|
|
74
|
+
/**
|
|
75
|
+
* Get the network
|
|
76
|
+
*
|
|
77
|
+
* @returns The network
|
|
78
|
+
*/
|
|
79
|
+
getNetwork(): Network;
|
|
80
|
+
/**
|
|
81
|
+
* Sign a transaction
|
|
82
|
+
*
|
|
83
|
+
* @param transaction - The transaction to sign
|
|
84
|
+
* @returns The signed transaction
|
|
85
|
+
*/
|
|
86
|
+
signTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
87
|
+
/**
|
|
88
|
+
* Send a transaction
|
|
89
|
+
*
|
|
90
|
+
* @param transaction - The transaction to send
|
|
91
|
+
* @returns The signature
|
|
92
|
+
*/
|
|
93
|
+
sendTransaction(transaction: VersionedTransaction): Promise<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Sign and send a transaction
|
|
96
|
+
*
|
|
97
|
+
* @param transaction - The transaction to sign and send
|
|
98
|
+
* @returns The signature
|
|
99
|
+
*/
|
|
100
|
+
signAndSendTransaction(transaction: VersionedTransaction): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Get the status of a transaction
|
|
103
|
+
*
|
|
104
|
+
* @param signature - The signature
|
|
105
|
+
* @param options - The options for the status
|
|
106
|
+
* @returns The status
|
|
107
|
+
*/
|
|
108
|
+
getSignatureStatus(signature: string, options?: SignatureStatusConfig): Promise<RpcResponseAndContext<SignatureStatus | null>>;
|
|
109
|
+
/**
|
|
110
|
+
* Wait for signature receipt
|
|
111
|
+
*
|
|
112
|
+
* @param signature - The signature
|
|
113
|
+
* @returns The confirmation response
|
|
114
|
+
*/
|
|
115
|
+
waitForSignatureResult(signature: string): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
116
|
+
/**
|
|
117
|
+
* Get the name of the wallet provider
|
|
118
|
+
*
|
|
119
|
+
* @returns The name of the wallet provider
|
|
120
|
+
*/
|
|
121
|
+
getName(): string;
|
|
122
|
+
/**
|
|
123
|
+
* Get the balance of the wallet
|
|
124
|
+
*
|
|
125
|
+
* @returns The balance of the wallet
|
|
126
|
+
*/
|
|
127
|
+
getBalance(): Promise<bigint>;
|
|
128
|
+
/**
|
|
129
|
+
* Transfer SOL from the wallet to another address
|
|
130
|
+
*
|
|
131
|
+
* @param to - The base58 encoded address to transfer the SOL to
|
|
132
|
+
* @param value - The amount of SOL to transfer (as a decimal string, e.g. "0.0001")
|
|
133
|
+
* @returns The signature
|
|
134
|
+
*/
|
|
135
|
+
nativeTransfer(to: string, value: string): Promise<string>;
|
|
136
|
+
/**
|
|
137
|
+
* Request SOL tokens from the Solana faucet. This method only works on devnet and testnet networks.
|
|
138
|
+
*
|
|
139
|
+
* @param lamports - The amount of lamports (1 SOL = 1,000,000,000 lamports) to request from the faucet
|
|
140
|
+
* @returns A Promise that resolves to the signature of the airdrop
|
|
141
|
+
*/
|
|
142
|
+
requestAirdrop(lamports: number): Promise<string>;
|
|
143
|
+
}
|