@gauntlet-xyz/sdk 0.0.1 → 1.0.0

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 (2) hide show
  1. package/README.md +4 -107
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Official Gauntlet SDK for interacting with Gauntlet-managed vaults — deposits, withdrawals, and on-chain attribution.
4
4
 
5
+ ## Documentation
6
+
7
+ Full documentation, guides, and API reference at **[docs.gauntlet.xyz](https://docs.gauntlet.xyz/)**.
8
+
5
9
  ## Installation
6
10
 
7
11
  ```bash
@@ -11,110 +15,3 @@ yarn add @gauntlet-xyz/sdk viem
11
15
  ```
12
16
 
13
17
  > `viem` is a required peer dependency.
14
-
15
- ## Quick start
16
-
17
- ```ts
18
- import { GauntletClient } from '@gauntlet-xyz/sdk';
19
- import { getDepositTx, getWithdrawTx, getVaults, VaultId } from '@gauntlet-xyz/sdk/evm';
20
- import { createPublicClient, createWalletClient, http } from 'viem';
21
- import { base } from 'viem/chains';
22
- import { privateKeyToAccount } from 'viem/accounts';
23
-
24
- const publicClient = createPublicClient({ chain: base, transport: http() });
25
-
26
- const wallet = createWalletClient({
27
- account: privateKeyToAccount('0x...'),
28
- chain: base,
29
- transport: http(),
30
- });
31
-
32
- const client = new GauntletClient({
33
- wallet,
34
- evmClients: {
35
- [base.id]: publicClient,
36
- },
37
- });
38
-
39
- // List available vaults
40
- const vaults = await getVaults(client, { chainId: base.id });
41
-
42
- // Build deposit transaction steps
43
- const steps = await getDepositTx(client, {
44
- vaultId: VaultId.BaseUsdcPrime,
45
- chainId: base.id,
46
- amount: 1_000_000n, // 1 USDC (6 decimals)
47
- });
48
-
49
- // Execute each step with your wallet
50
- for (const step of steps) {
51
- await wallet.writeContract(step);
52
- }
53
- ```
54
-
55
- ## API
56
-
57
- ### `GauntletClient`
58
-
59
- ```ts
60
- new GauntletClient(config: GauntletClientConfig)
61
- ```
62
-
63
- | Option | Type | Description |
64
- |---|---|---|
65
- | `wallet` | `WalletClient` | Viem wallet client (provides the signer address) |
66
- | `evmClients` | `Record<number, PublicClient>` | Map of chainId → viem PublicClient |
67
- | `attributionMode` | `AttributionMode` | `PUBLIC` (default), `ENCODED`, or `PRIVATE` |
68
- | `builderCode` | `string` | ERC-8021 builder identifier appended to calldata |
69
- | `apiKey` | `string` | Gauntlet API key (reserved for future use) |
70
-
71
- ### `getVaults(client, filter?)`
72
-
73
- Returns vaults from the bundled manifest. Optionally filter by `chainId` or `protocol`.
74
-
75
- ### `getDepositTx(client, params)`
76
-
77
- Returns an array of `EvmTxStep` objects (approve + deposit) ready to pass to `walletClient.writeContract`.
78
-
79
- | Param | Type | Description |
80
- |---|---|---|
81
- | `vaultId` | `string` | Vault identifier from the manifest |
82
- | `amount` | `bigint` | Amount in supply token base units |
83
- | `chainId` | `number` | Target chain (defaults to Base) |
84
- | `depositMode` | `string` | `'sync'` or `'async'`; defaults to the vault's configured mode |
85
- | `receiver` | `Address` | Recipient of vault shares (defaults to wallet address) |
86
-
87
- ### `getWithdrawTx(client, params)`
88
-
89
- Returns an array of `EvmTxStep` objects ready to pass to `walletClient.writeContract`. Specify exactly one of `shares`, `amount`, or `entireAmount: true`.
90
-
91
- | Param | Type | Description |
92
- |---|---|---|
93
- | `vaultId` | `string` | Vault identifier from the manifest |
94
- | `chainId` | `number` | Target chain (defaults to Base) |
95
- | `receiver` | `Address` | Recipient of withdrawn tokens (defaults to wallet address) |
96
- | `shares` | `bigint` | Redeem a specific number of vault shares |
97
- | `amount` | `bigint` | Redeem shares worth a specific token amount |
98
- | `entireAmount` | `true` | Redeem all shares held by the wallet |
99
-
100
- ## Attribution
101
-
102
- The SDK supports ERC-8021 builder attribution. Pass a `builderCode` to the client config and it will be appended to transaction calldata automatically under `AttributionMode.PUBLIC` (the default).
103
-
104
- ## Error handling
105
-
106
- All errors extend `GauntletSDKError` and can be caught by class:
107
-
108
- ```ts
109
- import { VaultNotFoundError, AccountRequiredError } from '@gauntlet-xyz/sdk';
110
-
111
- try {
112
- const steps = await getDepositTx(client, params);
113
- } catch (e) {
114
- if (e instanceof VaultNotFoundError) {
115
- console.error('Unknown vault:', e.vaultId);
116
- }
117
- }
118
- ```
119
-
120
- Available error classes: `VaultNotFoundError`, `AccountRequiredError`, `RpcNotConfiguredError`, `UnsupportedDepositModeError`, `UnsupportedProtocolError`, `UnsupportedAssetError`, `InvalidWithdrawParamsError`, `ChainMismatchError`, `UnimplementedFeatureError`, `UnitConversionError`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gauntlet-xyz/sdk",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "description": "Official Gauntlet SDK for vault deposits, withdrawals, and attribution",
5
5
  "license": "MIT",
6
6
  "keywords": [