@gauntlet-xyz/sdk 0.0.1

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.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +120 -0
  3. package/dist/manifest/vaults.json +139 -0
  4. package/dist/src/attribution/erc8021.d.ts +2 -0
  5. package/dist/src/attribution/erc8021.js +7 -0
  6. package/dist/src/attribution/erc8021.js.map +1 -0
  7. package/dist/src/attribution/index.d.ts +16 -0
  8. package/dist/src/attribution/index.js +37 -0
  9. package/dist/src/attribution/index.js.map +1 -0
  10. package/dist/src/client.d.ts +28 -0
  11. package/dist/src/client.js +35 -0
  12. package/dist/src/client.js.map +1 -0
  13. package/dist/src/errors.d.ts +55 -0
  14. package/dist/src/errors.js +97 -0
  15. package/dist/src/errors.js.map +1 -0
  16. package/dist/src/evm/abis/erc20.d.ts +40 -0
  17. package/dist/src/evm/abis/erc20.js +30 -0
  18. package/dist/src/evm/abis/erc20.js.map +1 -0
  19. package/dist/src/evm/abis/erc4626.d.ts +104 -0
  20. package/dist/src/evm/abis/erc4626.js +70 -0
  21. package/dist/src/evm/abis/erc4626.js.map +1 -0
  22. package/dist/src/evm/abis/multiDepositorVault.d.ts +1047 -0
  23. package/dist/src/evm/abis/multiDepositorVault.js +587 -0
  24. package/dist/src/evm/abis/multiDepositorVault.js.map +1 -0
  25. package/dist/src/evm/abis/priceAndFeeCalculator.d.ts +909 -0
  26. package/dist/src/evm/abis/priceAndFeeCalculator.js +490 -0
  27. package/dist/src/evm/abis/priceAndFeeCalculator.js.map +1 -0
  28. package/dist/src/evm/abis/provisioner.d.ts +4983 -0
  29. package/dist/src/evm/abis/provisioner.js +2738 -0
  30. package/dist/src/evm/abis/provisioner.js.map +1 -0
  31. package/dist/src/evm/adapters/aera.d.ts +5 -0
  32. package/dist/src/evm/adapters/aera.js +144 -0
  33. package/dist/src/evm/adapters/aera.js.map +1 -0
  34. package/dist/src/evm/adapters/index.d.ts +2 -0
  35. package/dist/src/evm/adapters/index.js +14 -0
  36. package/dist/src/evm/adapters/index.js.map +1 -0
  37. package/dist/src/evm/adapters/morpho.d.ts +2 -0
  38. package/dist/src/evm/adapters/morpho.js +79 -0
  39. package/dist/src/evm/adapters/morpho.js.map +1 -0
  40. package/dist/src/evm/adapters/types.d.ts +65 -0
  41. package/dist/src/evm/adapters/types.js +2 -0
  42. package/dist/src/evm/adapters/types.js.map +1 -0
  43. package/dist/src/evm/aeraContracts.d.ts +2315 -0
  44. package/dist/src/evm/aeraContracts.js +37 -0
  45. package/dist/src/evm/aeraContracts.js.map +1 -0
  46. package/dist/src/evm/deposit.d.ts +13 -0
  47. package/dist/src/evm/deposit.js +66 -0
  48. package/dist/src/evm/deposit.js.map +1 -0
  49. package/dist/src/evm/index.d.ts +10 -0
  50. package/dist/src/evm/index.js +5 -0
  51. package/dist/src/evm/index.js.map +1 -0
  52. package/dist/src/evm/types.d.ts +27 -0
  53. package/dist/src/evm/types.js +2 -0
  54. package/dist/src/evm/types.js.map +1 -0
  55. package/dist/src/evm/userCurrentBalance.d.ts +16 -0
  56. package/dist/src/evm/userCurrentBalance.js +164 -0
  57. package/dist/src/evm/userCurrentBalance.js.map +1 -0
  58. package/dist/src/evm/vaults.d.ts +17 -0
  59. package/dist/src/evm/vaults.js +39 -0
  60. package/dist/src/evm/vaults.js.map +1 -0
  61. package/dist/src/evm/withdraw.d.ts +24 -0
  62. package/dist/src/evm/withdraw.js +51 -0
  63. package/dist/src/evm/withdraw.js.map +1 -0
  64. package/dist/src/index.d.ts +7 -0
  65. package/dist/src/index.js +4 -0
  66. package/dist/src/index.js.map +1 -0
  67. package/dist/tsconfig.tsbuildinfo +1 -0
  68. package/manifest/vaults.json +139 -0
  69. package/package.json +64 -0
  70. package/src/attribution/erc8021.ts +14 -0
  71. package/src/attribution/index.ts +62 -0
  72. package/src/client.ts +95 -0
  73. package/src/errors.ts +135 -0
  74. package/src/evm/abis/erc20.ts +29 -0
  75. package/src/evm/abis/erc4626.ts +69 -0
  76. package/src/evm/abis/multiDepositorVault.ts +586 -0
  77. package/src/evm/abis/priceAndFeeCalculator.ts +489 -0
  78. package/src/evm/abis/provisioner.ts +2787 -0
  79. package/src/evm/adapters/aera.ts +254 -0
  80. package/src/evm/adapters/index.ts +15 -0
  81. package/src/evm/adapters/morpho.ts +92 -0
  82. package/src/evm/adapters/types.ts +64 -0
  83. package/src/evm/aeraContracts.ts +82 -0
  84. package/src/evm/deposit.ts +137 -0
  85. package/src/evm/index.ts +11 -0
  86. package/src/evm/types.ts +34 -0
  87. package/src/evm/userCurrentBalance.ts +265 -0
  88. package/src/evm/vaults.ts +88 -0
  89. package/src/evm/withdraw.ts +127 -0
  90. package/src/index.ts +28 -0
@@ -0,0 +1,139 @@
1
+ {
2
+ "version": "2026-03-24",
3
+ "vaults": [
4
+ {
5
+ "vaultId": "baseUsdcPrime",
6
+ "name": "Gauntlet USDC Prime",
7
+ "protocol": "morpho",
8
+ "strategy": "Prime Lending",
9
+ "deployments": [
10
+ {
11
+ "chain": "evm",
12
+ "chainId": 8453,
13
+ "vaultAddress": "0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61",
14
+ "vaultType": "single-depositor",
15
+ "depositMode": "sync",
16
+ "supplyToken": [
17
+ {
18
+ "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
19
+ "symbol": "USDC",
20
+ "decimals": 6
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "vaultId": "ethUsdcPrime",
28
+ "name": "Gauntlet USDC Prime",
29
+ "protocol": "morpho",
30
+ "strategy": "Prime Lending",
31
+ "deployments": [
32
+ {
33
+ "chain": "evm",
34
+ "chainId": 1,
35
+ "vaultAddress": "0xdd0f28e19C1780eb6396170735D45153D261490d",
36
+ "vaultType": "single-depositor",
37
+ "depositMode": "sync",
38
+ "supplyToken": [
39
+ {
40
+ "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
41
+ "symbol": "USDC",
42
+ "decimals": 6
43
+ }
44
+ ]
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "vaultId": "gtusda",
50
+ "name": "Gauntlet USD Alpha",
51
+ "protocol": "aera",
52
+ "strategy": "Multi-strategy Stablecoin Yield",
53
+ "deployments": [
54
+ {
55
+ "chain": "evm",
56
+ "chainId": 8453,
57
+ "vaultAddress": "0x000000000001CdB57E58Fa75Fe420a0f4D6640D5",
58
+ "provisionerAddress": "0x18CF8d963E1a727F9bbF3AEffa0Bd04FB4dBdA07",
59
+ "vaultType": "multi-depositor",
60
+ "depositMode": "async",
61
+ "supplyToken": [
62
+ {
63
+ "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
64
+ "symbol": "USDC",
65
+ "decimals": 6
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "chain": "evm",
71
+ "chainId": 1,
72
+ "vaultAddress": "0x3bd9248048df95db4fbd748c6cd99c1baa40bad0",
73
+ "provisionerAddress": "0x74C4A66CE4F4779B11E7c63D42e51EEef3A80D11",
74
+ "vaultType": "multi-depositor",
75
+ "depositMode": "async",
76
+ "supplyToken": [
77
+ {
78
+ "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
79
+ "symbol": "USDC",
80
+ "decimals": 6
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ "chain": "evm",
86
+ "chainId": 42161,
87
+ "vaultAddress": "0x000000001DC8bd45d7E7829fb1c969cbe4D0D1eC",
88
+ "provisionerAddress": "0xDd4a42603E6d8E515C3468789375A98c376821b3",
89
+ "vaultType": "multi-depositor",
90
+ "depositMode": "async",
91
+ "supplyToken": [
92
+ {
93
+ "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
94
+ "symbol": "USDC",
95
+ "decimals": 6
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "chain": "evm",
101
+ "chainId": 10,
102
+ "vaultAddress": "0x000000001DC8bd45d7E7829fb1c969cbe4D0D1eC",
103
+ "provisionerAddress": "0xCC923371F0d3A9cA75d98E767Df9dE1cdf5799Ef",
104
+ "vaultType": "multi-depositor",
105
+ "depositMode": "async",
106
+ "supplyToken": [
107
+ {
108
+ "address": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
109
+ "symbol": "USDC",
110
+ "decimals": 6
111
+ }
112
+ ]
113
+ }
114
+ ]
115
+ },
116
+ {
117
+ "vaultId": "ethUsdcPrimeV2",
118
+ "name": "Gauntlet USDC Prime v2",
119
+ "protocol": "morpho",
120
+ "strategy": "Prime Lending v2",
121
+ "deployments": [
122
+ {
123
+ "chain": "evm",
124
+ "chainId": 1,
125
+ "vaultAddress": "0x8c106EEDAd96553e64287A5A6839c3Cc78afA3D0",
126
+ "vaultType": "single-depositor",
127
+ "depositMode": "sync",
128
+ "supplyToken": [
129
+ {
130
+ "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
131
+ "symbol": "USDC",
132
+ "decimals": 6
133
+ }
134
+ ]
135
+ }
136
+ ]
137
+ }
138
+ ]
139
+ }
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@gauntlet-xyz/sdk",
3
+ "version": "0.0.1",
4
+ "description": "Official Gauntlet SDK for vault deposits, withdrawals, and attribution",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "gauntlet",
8
+ "defi",
9
+ "vault",
10
+ "aera",
11
+ "evm",
12
+ "viem",
13
+ "deposit",
14
+ "withdraw",
15
+ "sdk"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org"
20
+ },
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "main": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./evm": {
31
+ "types": "./dist/evm/index.d.ts",
32
+ "import": "./dist/evm/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "src",
38
+ "manifest"
39
+ ],
40
+ "scripts": {
41
+ "build": "tsc --project tsconfig.json",
42
+ "dev": "tsc --project tsconfig.json --watch",
43
+ "test": "vitest run",
44
+ "test:watch": "vitest",
45
+ "lint": "eslint --ext=tsx,ts,js src && echo-cli '✔ No ESLint warnings or errors'",
46
+ "format": "eslint --fix --quiet --ext=tsx,ts,js src && echo-cli '✔ No ESLint warnings or errors'",
47
+ "typecheck": "npx tsc --noEmit",
48
+ "clean": "rm -rf dist .turbo"
49
+ },
50
+ "peerDependencies": {
51
+ "viem": ">=2.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@next/eslint-plugin-next": "13.1.1",
55
+ "@types/node": "^18.15.11",
56
+ "@viem/anvil": "^0.0.10",
57
+ "echo-cli": "^2.0.0",
58
+ "eslint": "^8.57.0",
59
+ "typescript": "^5.5.4",
60
+ "viem": "2.30.1",
61
+ "vitest": "^4.1.2"
62
+ },
63
+ "packageManager": "yarn@4.3.1"
64
+ }
@@ -0,0 +1,14 @@
1
+ import { toHex, type Hex } from 'viem';
2
+
3
+ const ERC8021_PREFIX = '8021' as const;
4
+
5
+ /**
6
+ * Encode an ERC-8021 builder code as a calldata suffix.
7
+ * Format: "8021" marker + utf8-encoded builder code
8
+ *
9
+ * @see https://eips.ethereum.org/EIPS/eip-8021
10
+ */
11
+ export function encodeBuilderCode(builderCode: string): Hex {
12
+ const codeHex = toHex(builderCode).slice(2); // remove 0x prefix
13
+ return `0x${ERC8021_PREFIX}${codeHex}` as Hex;
14
+ }
@@ -0,0 +1,62 @@
1
+ import { Address, encodeFunctionData, type Hex } from 'viem';
2
+ import { encodeBuilderCode } from './erc8021';
3
+ import { AttributionMode, GauntletClient } from '../client';
4
+ import { UnimplementedFeatureError } from '../errors';
5
+ import { TxStep } from '../evm/adapters/types';
6
+ export { encodeBuilderCode } from './erc8021';
7
+
8
+ export type PreparedPayloadWithAttribution = {
9
+ type: string;
10
+ to: Address;
11
+ data: Hex;
12
+ account?: Address;
13
+ };
14
+
15
+ export type PreparedTx = {
16
+ payload: PreparedPayloadWithAttribution;
17
+ tx: TxStep;
18
+ };
19
+
20
+ /**
21
+ * Build the full attribution suffix to append to transaction calldata.
22
+ *
23
+ * PUBLIC: ERC-8021 builder code only — `0x8021{builderCode utf8}`, or `0x` if no builderCode.
24
+ * ENCODED: Requests a sourceId from the Gauntlet API with builder code as an arg and encodes that.
25
+ * PRIVATE: Generates a random salt and posts it to the Gauntlet API.
26
+ *
27
+ */
28
+ export async function buildAttribution(client: GauntletClient): Promise<Hex> {
29
+ switch (client.attributionMode) {
30
+ case AttributionMode.PUBLIC:
31
+ return client.builderCode ? encodeBuilderCode(client.builderCode) : '0x';
32
+ case AttributionMode.ENCODED:
33
+ throw new UnimplementedFeatureError('AttributionMode.ENCODED');
34
+ case AttributionMode.PRIVATE:
35
+ throw new UnimplementedFeatureError('AttributionMode.PRIVATE');
36
+ }
37
+ }
38
+
39
+ export async function encodeTransactionWithAttribution(
40
+ client: GauntletClient,
41
+ transaction: TxStep
42
+ ): Promise<PreparedTx> {
43
+ const customAttribution = await buildAttribution(client);
44
+ const encodedTx = encodeFunctionData({
45
+ abi: transaction.abi,
46
+ functionName: transaction.functionName,
47
+ args: transaction.args,
48
+ });
49
+ const encodedTxWithAttribution = `${encodedTx}${customAttribution.replace('0x', '')}` as Hex;
50
+ return {
51
+ payload: {
52
+ type: transaction.type,
53
+ account: transaction.account,
54
+ to: transaction.address,
55
+ data: encodedTxWithAttribution,
56
+ },
57
+ tx: {
58
+ ...transaction,
59
+ attribution: customAttribution,
60
+ },
61
+ };
62
+ }
package/src/client.ts ADDED
@@ -0,0 +1,95 @@
1
+ import { type PublicClient, type WalletClient } from 'viem';
2
+ import bundledManifest from '../manifest/vaults.json';
3
+ import { RpcNotConfiguredError, UnimplementedFeatureError } from './errors';
4
+ import type { VaultManifest } from './evm/types';
5
+ import { base } from 'viem/chains';
6
+
7
+ /**
8
+ * Controls how builder attribution is appended to transactions.
9
+ *
10
+ * - `PUBLIC` – attribution is sent as plain calldata (default).
11
+ * - `ENCODED` – attribution is encoded using ERC-8021 with a builder code fetched from the API.
12
+ * - `PRIVATE` – no attribution data is appended.
13
+ */
14
+ export enum AttributionMode {
15
+ PUBLIC = 'public',
16
+ ENCODED = 'encoded',
17
+ PRIVATE = 'private',
18
+ }
19
+
20
+ export type ChainId = string | number;
21
+
22
+ export interface GauntletClientConfig {
23
+ apiKey?: string;
24
+ /** Map of chainId → PublicClient, e.g. { [base.id]: createPublicClient(...) } */
25
+ evmClients?: Record<ChainId, PublicClient>;
26
+ attributionMode?: AttributionMode;
27
+ builderCode?: string;
28
+ /** Viem WalletClient for signing transactions. */
29
+ wallet?: WalletClient;
30
+ }
31
+
32
+ /**
33
+ * Main entry point for the Gauntlet SDK.
34
+ *
35
+ * Holds configuration (RPC clients, wallet, attribution mode) and exposes helpers
36
+ * for reading the vault manifest. Pass an instance of this class to every SDK
37
+ * function (e.g. `getDepositTx`, `getWithdrawTx`, `getVaults`).
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { createPublicClient, createWalletClient, http } from 'viem';
42
+ * import { base } from 'viem/chains';
43
+ * import { GauntletClient, AttributionMode } from '@gauntlet-xyz/sdk';
44
+ *
45
+ * const wallet = createWalletClient({
46
+ * account: privateKeyToAccount('0x...'), // or other account source
47
+ * chain: base,
48
+ * transport: http()
49
+ * })
50
+ *
51
+ * const client = new GauntletClient({
52
+ * evmClients: { [base.id]: createPublicClient({ chain: base, transport: http() }) },
53
+ * wallet,
54
+ * attributionMode: AttributionMode.PUBLIC,
55
+ * });
56
+ * ```
57
+ */
58
+ export class GauntletClient {
59
+ // used for future core api and encoding attribution
60
+ readonly apiKey?: string;
61
+ readonly builderCode?: string;
62
+ readonly attributionMode: AttributionMode;
63
+ readonly evmClients: Record<ChainId, PublicClient>;
64
+ readonly wallet?: WalletClient;
65
+
66
+ private _manifest: VaultManifest = bundledManifest as VaultManifest;
67
+
68
+ constructor(config: GauntletClientConfig) {
69
+ this.apiKey = config.apiKey;
70
+ this.evmClients = config.evmClients ?? {};
71
+ this.attributionMode = config.attributionMode ?? AttributionMode.PUBLIC;
72
+ this.builderCode = config.builderCode;
73
+ this.wallet = config.wallet;
74
+ }
75
+
76
+ get manifest(): Promise<VaultManifest> {
77
+ return Promise.resolve(this._manifest);
78
+ }
79
+
80
+ setManifest(manifest: VaultManifest): void {
81
+ this._manifest = manifest;
82
+ }
83
+
84
+ getPublicClient(chainId: ChainId = base.id): PublicClient {
85
+ const client = this.evmClients[chainId];
86
+ if (!client) throw new RpcNotConfiguredError(chainId);
87
+ return client;
88
+ }
89
+
90
+ // Will be used for encoded attribution
91
+ // Will use apiKey to get a builder ID from core api
92
+ async getSourceId(): Promise<string> {
93
+ throw new UnimplementedFeatureError('getSourceId');
94
+ }
95
+ }
package/src/errors.ts ADDED
@@ -0,0 +1,135 @@
1
+ import { ChainId } from './client';
2
+
3
+ export class GauntletSDKError extends Error {
4
+ constructor(message: string) {
5
+ super(message);
6
+ this.name = 'GauntletSDKError';
7
+ }
8
+ }
9
+
10
+ export class VaultNotFoundError extends GauntletSDKError {
11
+ readonly vaultId: string;
12
+ readonly chainId?: ChainId;
13
+
14
+ constructor(vaultId: string, chainId?: ChainId) {
15
+ const msg = chainId
16
+ ? `Vault "${vaultId}" not found on chainId "${chainId}"`
17
+ : `Vault "${vaultId}" not found`;
18
+ super(msg);
19
+ this.name = 'VaultNotFoundError';
20
+ this.vaultId = vaultId;
21
+ this.chainId = chainId;
22
+ }
23
+ }
24
+
25
+ export class UnsupportedAssetError extends GauntletSDKError {
26
+ readonly asset: string;
27
+ readonly vaultId: string;
28
+
29
+ constructor(asset: string, vaultId: string) {
30
+ super(`Asset "${asset}" is not supported by vault "${vaultId}"`);
31
+ this.name = 'UnsupportedAssetError';
32
+ this.asset = asset;
33
+ this.vaultId = vaultId;
34
+ }
35
+ }
36
+
37
+ export class ChainMismatchError extends GauntletSDKError {
38
+ readonly expected: string;
39
+ readonly received: string;
40
+
41
+ constructor(expected: string, received: string) {
42
+ super(`Chain mismatch: expected "${expected}", received "${received}"`);
43
+ this.name = 'ChainMismatchError';
44
+ this.expected = expected;
45
+ this.received = received;
46
+ }
47
+ }
48
+
49
+ export class UnsupportedDepositModeError extends GauntletSDKError {
50
+ readonly vaultId: string;
51
+ readonly requested: 'sync' | 'async';
52
+ readonly available: string;
53
+
54
+ constructor(vaultId: string, requested: 'sync' | 'async', available: string) {
55
+ super(`Vault "${vaultId}" does not support ${requested} deposits (available: ${available})`);
56
+ this.name = 'UnsupportedDepositModeError';
57
+ this.vaultId = vaultId;
58
+ this.requested = requested;
59
+ this.available = available;
60
+ }
61
+ }
62
+
63
+ export class RpcNotConfiguredError extends GauntletSDKError {
64
+ readonly chainId: ChainId;
65
+
66
+ constructor(chainId: ChainId) {
67
+ super(`No client configured for chainId "${chainId}"`);
68
+ this.name = 'RpcNotConfiguredError';
69
+ this.chainId = chainId;
70
+ }
71
+ }
72
+
73
+ export class AccountRequiredError extends GauntletSDKError {
74
+ constructor() {
75
+ super('No account specified. Provide a wallet in the client config.');
76
+ this.name = 'AccountRequiredError';
77
+ }
78
+ }
79
+
80
+ export class UnsupportedProtocolError extends GauntletSDKError {
81
+ readonly protocol: string;
82
+
83
+ constructor(protocol: string) {
84
+ super(`Unsupported protocol: "${protocol}"`);
85
+ this.name = 'UnsupportedProtocolError';
86
+ this.protocol = protocol;
87
+ }
88
+ }
89
+
90
+ export class InvalidWithdrawParamsError extends GauntletSDKError {
91
+ constructor() {
92
+ super('Withdraw requires exactly one of: shares, amount, or all');
93
+ this.name = 'InvalidWithdrawParamsError';
94
+ }
95
+ }
96
+
97
+ export class UnimplementedFeatureError extends GauntletSDKError {
98
+ readonly feature: string;
99
+
100
+ constructor(feature: string) {
101
+ super(`Feature not yet implemented: "${feature}"`);
102
+ this.name = 'UnimplementedFeatureError';
103
+ this.feature = feature;
104
+ }
105
+ }
106
+
107
+ export class UnsupportedFeatureError extends GauntletSDKError {
108
+ readonly feature: string;
109
+
110
+ constructor(feature: string) {
111
+ super(`Feature not supported: "${feature}"`);
112
+ this.name = 'UnimplementedFeatureError';
113
+ this.feature = feature;
114
+ }
115
+ }
116
+
117
+ export class UnitConversionError extends GauntletSDKError {
118
+ readonly vaultAddress: string;
119
+
120
+ constructor(vaultAddress: string) {
121
+ super(`Failed to convert token units for vault "${vaultAddress}": fee calculator unavailable`);
122
+ this.name = 'UnitConversionError';
123
+ this.vaultAddress = vaultAddress;
124
+ }
125
+ }
126
+
127
+ export class InvalidSlippageBPSError extends GauntletSDKError {
128
+ readonly slippage: number;
129
+
130
+ constructor(slippage: number) {
131
+ super(`Slippage not in range of 10000-0; argumet passed: ${slippage}`);
132
+ this.name = 'IncorrectArgument';
133
+ this.slippage = slippage;
134
+ }
135
+ }
@@ -0,0 +1,29 @@
1
+ export const erc20Abi = [
2
+ {
3
+ type: 'function',
4
+ name: 'approve',
5
+ inputs: [
6
+ { name: 'spender', type: 'address' },
7
+ { name: 'amount', type: 'uint256' },
8
+ ],
9
+ outputs: [{ type: 'bool' }],
10
+ stateMutability: 'nonpayable',
11
+ },
12
+ {
13
+ type: 'function',
14
+ name: 'allowance',
15
+ inputs: [
16
+ { name: 'owner', type: 'address' },
17
+ { name: 'spender', type: 'address' },
18
+ ],
19
+ outputs: [{ type: 'uint256' }],
20
+ stateMutability: 'view',
21
+ },
22
+ {
23
+ type: 'function',
24
+ name: 'balanceOf',
25
+ inputs: [{ name: 'account', type: 'address' }],
26
+ outputs: [{ type: 'uint256' }],
27
+ stateMutability: 'view',
28
+ },
29
+ ] as const;
@@ -0,0 +1,69 @@
1
+ export const erc4626Abi = [
2
+ {
3
+ type: 'function',
4
+ name: 'deposit',
5
+ inputs: [
6
+ { name: 'assets', type: 'uint256' },
7
+ { name: 'receiver', type: 'address' },
8
+ ],
9
+ outputs: [{ type: 'uint256' }],
10
+ stateMutability: 'nonpayable',
11
+ },
12
+ {
13
+ type: 'function',
14
+ name: 'redeem',
15
+ inputs: [
16
+ { name: 'shares', type: 'uint256' },
17
+ { name: 'receiver', type: 'address' },
18
+ { name: 'owner', type: 'address' },
19
+ ],
20
+ outputs: [{ type: 'uint256' }],
21
+ stateMutability: 'nonpayable',
22
+ },
23
+ {
24
+ type: 'function',
25
+ name: 'convertToShares',
26
+ inputs: [{ name: 'assets', type: 'uint256' }],
27
+ outputs: [{ type: 'uint256' }],
28
+ stateMutability: 'view',
29
+ },
30
+ {
31
+ type: 'function',
32
+ name: 'convertToAssets',
33
+ inputs: [{ name: 'shares', type: 'uint256' }],
34
+ outputs: [{ type: 'uint256' }],
35
+ stateMutability: 'view',
36
+ },
37
+ {
38
+ type: 'function',
39
+ name: 'balanceOf',
40
+ inputs: [{ name: 'account', type: 'address' }],
41
+ outputs: [{ type: 'uint256' }],
42
+ stateMutability: 'view',
43
+ },
44
+ {
45
+ type: 'function',
46
+ name: 'maxDeposit',
47
+ inputs: [{ name: 'receiver', type: 'address' }],
48
+ outputs: [{ type: 'uint256' }],
49
+ stateMutability: 'view',
50
+ },
51
+ {
52
+ type: 'function',
53
+ name: 'maxRedeem',
54
+ inputs: [{ name: 'owner', type: 'address' }],
55
+ outputs: [{ type: 'uint256' }],
56
+ stateMutability: 'view',
57
+ },
58
+ {
59
+ type: 'function',
60
+ name: 'withdraw',
61
+ inputs: [
62
+ { name: 'assets', type: 'uint256' },
63
+ { name: 'receiver', type: 'address' },
64
+ { name: 'owner', type: 'address' },
65
+ ],
66
+ outputs: [{ type: 'uint256' }],
67
+ stateMutability: 'nonpayable',
68
+ },
69
+ ] as const;