@proofchain/sdk 2.1.0 → 2.2.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.
package/dist/index.d.mts CHANGED
@@ -1007,13 +1007,6 @@ interface WalletBalance {
1007
1007
  network: string;
1008
1008
  balances: TokenBalance[];
1009
1009
  }
1010
- interface TokenBalance {
1011
- token: string;
1012
- symbol: string;
1013
- balance: string;
1014
- decimals: number;
1015
- usd_value?: number;
1016
- }
1017
1010
  interface NFT {
1018
1011
  id: string;
1019
1012
  wallet_id: string;
@@ -1051,6 +1044,25 @@ interface WalletStats {
1051
1044
  by_type: Record<string, number>;
1052
1045
  by_network: Record<string, number>;
1053
1046
  }
1047
+ interface Transaction {
1048
+ hash: string;
1049
+ type: 'sent' | 'received';
1050
+ from: string;
1051
+ to: string;
1052
+ value: number | string;
1053
+ asset: string;
1054
+ category: string;
1055
+ block_num: string;
1056
+ timestamp: string;
1057
+ }
1058
+ interface TransactionHistory {
1059
+ address: string;
1060
+ network: string;
1061
+ total_sent: number;
1062
+ total_received: number;
1063
+ transactions: Transaction[];
1064
+ error?: string;
1065
+ }
1054
1066
  interface ComprehensiveWalletInfo {
1055
1067
  wallet_id: string;
1056
1068
  address: string;
@@ -1138,11 +1150,20 @@ interface AddNFTRequest {
1138
1150
  source?: string;
1139
1151
  }
1140
1152
  interface TransferRequest {
1141
- from_address: string;
1153
+ /** Source wallet address (required if wallet_id not provided) */
1154
+ from_address?: string;
1155
+ /** Source wallet ID (alternative to from_address) */
1156
+ wallet_id?: string;
1157
+ /** Destination address */
1142
1158
  to_address: string;
1159
+ /** Amount to transfer (in token units, e.g., "0.1" for 0.1 ETH) */
1143
1160
  amount: string;
1161
+ /** Token symbol (default: "ETH") */
1144
1162
  token?: string;
1163
+ /** Network (default: "base-sepolia") */
1145
1164
  network?: string;
1165
+ /** Contract address for custom ERC-20 tokens */
1166
+ contract_address?: string;
1146
1167
  }
1147
1168
  interface TransferResult {
1148
1169
  tx_hash: string;
@@ -1150,9 +1171,80 @@ interface TransferResult {
1150
1171
  to: string;
1151
1172
  amount: string;
1152
1173
  token: string;
1174
+ contract_address?: string;
1153
1175
  network: string;
1154
1176
  status: string;
1155
1177
  }
1178
+ interface Token {
1179
+ id: string;
1180
+ contract_address: string;
1181
+ network: string;
1182
+ symbol: string;
1183
+ name: string;
1184
+ decimals: number;
1185
+ logo_url?: string;
1186
+ color?: string;
1187
+ coingecko_id?: string;
1188
+ coinmarketcap_id?: string;
1189
+ token_standard: string;
1190
+ is_native_wrapper: boolean;
1191
+ is_verified: boolean;
1192
+ is_active: boolean;
1193
+ is_hidden?: boolean;
1194
+ display_order: number;
1195
+ is_global: boolean;
1196
+ }
1197
+ interface CreateTokenRequest {
1198
+ contract_address: string;
1199
+ network: string;
1200
+ symbol: string;
1201
+ name: string;
1202
+ decimals?: number;
1203
+ logo_url?: string;
1204
+ color?: string;
1205
+ coingecko_id?: string;
1206
+ coinmarketcap_id?: string;
1207
+ custom_price_feed_url?: string;
1208
+ is_native_wrapper?: boolean;
1209
+ display_order?: number;
1210
+ }
1211
+ interface UpdateTokenRequest {
1212
+ symbol?: string;
1213
+ name?: string;
1214
+ decimals?: number;
1215
+ logo_url?: string;
1216
+ color?: string;
1217
+ coingecko_id?: string;
1218
+ coinmarketcap_id?: string;
1219
+ custom_price_feed_url?: string;
1220
+ is_active?: boolean;
1221
+ is_hidden?: boolean;
1222
+ display_order?: number;
1223
+ }
1224
+ interface TokenBalance {
1225
+ token: string;
1226
+ symbol: string;
1227
+ balance: string;
1228
+ decimals: number;
1229
+ usd_value?: number;
1230
+ }
1231
+ interface TokenBalance {
1232
+ token: string;
1233
+ balance: string;
1234
+ raw_balance?: string;
1235
+ contract_address?: string;
1236
+ decimals: number;
1237
+ name?: string;
1238
+ logo_url?: string;
1239
+ source: 'cdp' | 'custom' | 'global';
1240
+ }
1241
+ interface WalletBalanceResponse {
1242
+ address: string;
1243
+ network: string;
1244
+ native_balance: string;
1245
+ native_symbol: string;
1246
+ balances: TokenBalance[];
1247
+ }
1156
1248
  interface UserWithWallets {
1157
1249
  user_id: string;
1158
1250
  wallets: Array<{
@@ -1206,9 +1298,11 @@ declare class WalletClient {
1206
1298
  */
1207
1299
  createDualBulk(userIds: string[], network?: string): Promise<DualWallets[]>;
1208
1300
  /**
1209
- * Get wallet balance
1301
+ * Get wallet balance including custom tokens.
1302
+ *
1303
+ * Returns native balance (ETH) plus all registered token balances.
1210
1304
  */
1211
- getBalance(walletId: string): Promise<WalletBalance>;
1305
+ getBalance(walletId: string): Promise<WalletBalanceResponse>;
1212
1306
  /**
1213
1307
  * Get comprehensive wallet information in a single call.
1214
1308
  *
@@ -1246,21 +1340,33 @@ declare class WalletClient {
1246
1340
  warning: string;
1247
1341
  }>;
1248
1342
  /**
1249
- * Transfer tokens from one address to another.
1343
+ * Transfer tokens from a CDP wallet to any address.
1250
1344
  *
1251
- * @param request - Transfer details
1345
+ * Supports native ETH and ERC-20 tokens. The source wallet must be a CDP-managed wallet.
1346
+ *
1347
+ * @param request - Transfer details (use wallet_id or from_address)
1252
1348
  * @returns Transaction result with hash and status
1253
1349
  *
1254
1350
  * @example
1255
1351
  * ```typescript
1352
+ * // Transfer ETH using wallet_id
1256
1353
  * const result = await client.wallets.transfer({
1257
- * from_address: '0x123...',
1354
+ * wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
1258
1355
  * to_address: '0x456...',
1259
- * amount: '0.1',
1356
+ * amount: '0.0001',
1260
1357
  * token: 'ETH',
1261
- * network: 'base-sepolia',
1358
+ * network: 'base-mainnet',
1262
1359
  * });
1263
1360
  * console.log('TX Hash:', result.tx_hash);
1361
+ *
1362
+ * // Transfer using from_address
1363
+ * const result2 = await client.wallets.transfer({
1364
+ * from_address: '0xaA2e82E5fCF97003d409Bc90826F40cfc8F27510',
1365
+ * to_address: '0x456...',
1366
+ * amount: '0.0001',
1367
+ * token: 'ETH',
1368
+ * network: 'base-mainnet',
1369
+ * });
1264
1370
  * ```
1265
1371
  */
1266
1372
  transfer(request: TransferRequest): Promise<TransferResult>;
@@ -1284,6 +1390,78 @@ declare class WalletClient {
1284
1390
  * Add an NFT to wallet tracking
1285
1391
  */
1286
1392
  addNFT(walletId: string, nft: AddNFTRequest): Promise<NFT>;
1393
+ /**
1394
+ * Get transaction history for a wallet.
1395
+ *
1396
+ * Returns both sent and received transactions including:
1397
+ * - Token transfers (ETH, ERC20)
1398
+ * - NFT transfers
1399
+ * - Contract interactions
1400
+ *
1401
+ * @param walletId - Wallet ID to query
1402
+ * @param options - Pagination options
1403
+ */
1404
+ getTransactions(walletId: string, options?: {
1405
+ limit?: number;
1406
+ offset?: number;
1407
+ }): Promise<TransactionHistory>;
1408
+ /**
1409
+ * Register a custom token for the tenant.
1410
+ *
1411
+ * This allows tracking balances and enabling transfers for custom ERC-20 tokens.
1412
+ *
1413
+ * @param request - Token details including contract address, symbol, decimals
1414
+ * @returns The created token
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * const token = await client.wallets.createToken({
1419
+ * contract_address: '0x...',
1420
+ * network: 'base-mainnet',
1421
+ * symbol: 'wSOL',
1422
+ * name: 'Wrapped Solana',
1423
+ * decimals: 9,
1424
+ * });
1425
+ * ```
1426
+ */
1427
+ createToken(request: CreateTokenRequest): Promise<Token>;
1428
+ /**
1429
+ * List all tokens available to the tenant.
1430
+ *
1431
+ * Returns both tenant-specific tokens and global tokens.
1432
+ *
1433
+ * @param options - Filter options
1434
+ */
1435
+ listTokens(options?: {
1436
+ network?: string;
1437
+ include_global?: boolean;
1438
+ include_hidden?: boolean;
1439
+ }): Promise<Token[]>;
1440
+ /**
1441
+ * List global tokens (available to all tenants).
1442
+ *
1443
+ * These are well-known tokens like USDC, WETH, DAI, etc.
1444
+ */
1445
+ listGlobalTokens(network?: string): Promise<Token[]>;
1446
+ /**
1447
+ * Get a specific token by ID.
1448
+ */
1449
+ getToken(tokenId: string): Promise<Token>;
1450
+ /**
1451
+ * Get a token by contract address and network.
1452
+ */
1453
+ getTokenByContract(contractAddress: string, network: string): Promise<Token>;
1454
+ /**
1455
+ * Update a custom token.
1456
+ */
1457
+ updateToken(tokenId: string, request: UpdateTokenRequest): Promise<Token>;
1458
+ /**
1459
+ * Delete a custom token (soft delete).
1460
+ */
1461
+ deleteToken(tokenId: string): Promise<{
1462
+ message: string;
1463
+ token_id: string;
1464
+ }>;
1287
1465
  }
1288
1466
 
1289
1467
  /**
package/dist/index.d.ts CHANGED
@@ -1007,13 +1007,6 @@ interface WalletBalance {
1007
1007
  network: string;
1008
1008
  balances: TokenBalance[];
1009
1009
  }
1010
- interface TokenBalance {
1011
- token: string;
1012
- symbol: string;
1013
- balance: string;
1014
- decimals: number;
1015
- usd_value?: number;
1016
- }
1017
1010
  interface NFT {
1018
1011
  id: string;
1019
1012
  wallet_id: string;
@@ -1051,6 +1044,25 @@ interface WalletStats {
1051
1044
  by_type: Record<string, number>;
1052
1045
  by_network: Record<string, number>;
1053
1046
  }
1047
+ interface Transaction {
1048
+ hash: string;
1049
+ type: 'sent' | 'received';
1050
+ from: string;
1051
+ to: string;
1052
+ value: number | string;
1053
+ asset: string;
1054
+ category: string;
1055
+ block_num: string;
1056
+ timestamp: string;
1057
+ }
1058
+ interface TransactionHistory {
1059
+ address: string;
1060
+ network: string;
1061
+ total_sent: number;
1062
+ total_received: number;
1063
+ transactions: Transaction[];
1064
+ error?: string;
1065
+ }
1054
1066
  interface ComprehensiveWalletInfo {
1055
1067
  wallet_id: string;
1056
1068
  address: string;
@@ -1138,11 +1150,20 @@ interface AddNFTRequest {
1138
1150
  source?: string;
1139
1151
  }
1140
1152
  interface TransferRequest {
1141
- from_address: string;
1153
+ /** Source wallet address (required if wallet_id not provided) */
1154
+ from_address?: string;
1155
+ /** Source wallet ID (alternative to from_address) */
1156
+ wallet_id?: string;
1157
+ /** Destination address */
1142
1158
  to_address: string;
1159
+ /** Amount to transfer (in token units, e.g., "0.1" for 0.1 ETH) */
1143
1160
  amount: string;
1161
+ /** Token symbol (default: "ETH") */
1144
1162
  token?: string;
1163
+ /** Network (default: "base-sepolia") */
1145
1164
  network?: string;
1165
+ /** Contract address for custom ERC-20 tokens */
1166
+ contract_address?: string;
1146
1167
  }
1147
1168
  interface TransferResult {
1148
1169
  tx_hash: string;
@@ -1150,9 +1171,80 @@ interface TransferResult {
1150
1171
  to: string;
1151
1172
  amount: string;
1152
1173
  token: string;
1174
+ contract_address?: string;
1153
1175
  network: string;
1154
1176
  status: string;
1155
1177
  }
1178
+ interface Token {
1179
+ id: string;
1180
+ contract_address: string;
1181
+ network: string;
1182
+ symbol: string;
1183
+ name: string;
1184
+ decimals: number;
1185
+ logo_url?: string;
1186
+ color?: string;
1187
+ coingecko_id?: string;
1188
+ coinmarketcap_id?: string;
1189
+ token_standard: string;
1190
+ is_native_wrapper: boolean;
1191
+ is_verified: boolean;
1192
+ is_active: boolean;
1193
+ is_hidden?: boolean;
1194
+ display_order: number;
1195
+ is_global: boolean;
1196
+ }
1197
+ interface CreateTokenRequest {
1198
+ contract_address: string;
1199
+ network: string;
1200
+ symbol: string;
1201
+ name: string;
1202
+ decimals?: number;
1203
+ logo_url?: string;
1204
+ color?: string;
1205
+ coingecko_id?: string;
1206
+ coinmarketcap_id?: string;
1207
+ custom_price_feed_url?: string;
1208
+ is_native_wrapper?: boolean;
1209
+ display_order?: number;
1210
+ }
1211
+ interface UpdateTokenRequest {
1212
+ symbol?: string;
1213
+ name?: string;
1214
+ decimals?: number;
1215
+ logo_url?: string;
1216
+ color?: string;
1217
+ coingecko_id?: string;
1218
+ coinmarketcap_id?: string;
1219
+ custom_price_feed_url?: string;
1220
+ is_active?: boolean;
1221
+ is_hidden?: boolean;
1222
+ display_order?: number;
1223
+ }
1224
+ interface TokenBalance {
1225
+ token: string;
1226
+ symbol: string;
1227
+ balance: string;
1228
+ decimals: number;
1229
+ usd_value?: number;
1230
+ }
1231
+ interface TokenBalance {
1232
+ token: string;
1233
+ balance: string;
1234
+ raw_balance?: string;
1235
+ contract_address?: string;
1236
+ decimals: number;
1237
+ name?: string;
1238
+ logo_url?: string;
1239
+ source: 'cdp' | 'custom' | 'global';
1240
+ }
1241
+ interface WalletBalanceResponse {
1242
+ address: string;
1243
+ network: string;
1244
+ native_balance: string;
1245
+ native_symbol: string;
1246
+ balances: TokenBalance[];
1247
+ }
1156
1248
  interface UserWithWallets {
1157
1249
  user_id: string;
1158
1250
  wallets: Array<{
@@ -1206,9 +1298,11 @@ declare class WalletClient {
1206
1298
  */
1207
1299
  createDualBulk(userIds: string[], network?: string): Promise<DualWallets[]>;
1208
1300
  /**
1209
- * Get wallet balance
1301
+ * Get wallet balance including custom tokens.
1302
+ *
1303
+ * Returns native balance (ETH) plus all registered token balances.
1210
1304
  */
1211
- getBalance(walletId: string): Promise<WalletBalance>;
1305
+ getBalance(walletId: string): Promise<WalletBalanceResponse>;
1212
1306
  /**
1213
1307
  * Get comprehensive wallet information in a single call.
1214
1308
  *
@@ -1246,21 +1340,33 @@ declare class WalletClient {
1246
1340
  warning: string;
1247
1341
  }>;
1248
1342
  /**
1249
- * Transfer tokens from one address to another.
1343
+ * Transfer tokens from a CDP wallet to any address.
1250
1344
  *
1251
- * @param request - Transfer details
1345
+ * Supports native ETH and ERC-20 tokens. The source wallet must be a CDP-managed wallet.
1346
+ *
1347
+ * @param request - Transfer details (use wallet_id or from_address)
1252
1348
  * @returns Transaction result with hash and status
1253
1349
  *
1254
1350
  * @example
1255
1351
  * ```typescript
1352
+ * // Transfer ETH using wallet_id
1256
1353
  * const result = await client.wallets.transfer({
1257
- * from_address: '0x123...',
1354
+ * wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
1258
1355
  * to_address: '0x456...',
1259
- * amount: '0.1',
1356
+ * amount: '0.0001',
1260
1357
  * token: 'ETH',
1261
- * network: 'base-sepolia',
1358
+ * network: 'base-mainnet',
1262
1359
  * });
1263
1360
  * console.log('TX Hash:', result.tx_hash);
1361
+ *
1362
+ * // Transfer using from_address
1363
+ * const result2 = await client.wallets.transfer({
1364
+ * from_address: '0xaA2e82E5fCF97003d409Bc90826F40cfc8F27510',
1365
+ * to_address: '0x456...',
1366
+ * amount: '0.0001',
1367
+ * token: 'ETH',
1368
+ * network: 'base-mainnet',
1369
+ * });
1264
1370
  * ```
1265
1371
  */
1266
1372
  transfer(request: TransferRequest): Promise<TransferResult>;
@@ -1284,6 +1390,78 @@ declare class WalletClient {
1284
1390
  * Add an NFT to wallet tracking
1285
1391
  */
1286
1392
  addNFT(walletId: string, nft: AddNFTRequest): Promise<NFT>;
1393
+ /**
1394
+ * Get transaction history for a wallet.
1395
+ *
1396
+ * Returns both sent and received transactions including:
1397
+ * - Token transfers (ETH, ERC20)
1398
+ * - NFT transfers
1399
+ * - Contract interactions
1400
+ *
1401
+ * @param walletId - Wallet ID to query
1402
+ * @param options - Pagination options
1403
+ */
1404
+ getTransactions(walletId: string, options?: {
1405
+ limit?: number;
1406
+ offset?: number;
1407
+ }): Promise<TransactionHistory>;
1408
+ /**
1409
+ * Register a custom token for the tenant.
1410
+ *
1411
+ * This allows tracking balances and enabling transfers for custom ERC-20 tokens.
1412
+ *
1413
+ * @param request - Token details including contract address, symbol, decimals
1414
+ * @returns The created token
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * const token = await client.wallets.createToken({
1419
+ * contract_address: '0x...',
1420
+ * network: 'base-mainnet',
1421
+ * symbol: 'wSOL',
1422
+ * name: 'Wrapped Solana',
1423
+ * decimals: 9,
1424
+ * });
1425
+ * ```
1426
+ */
1427
+ createToken(request: CreateTokenRequest): Promise<Token>;
1428
+ /**
1429
+ * List all tokens available to the tenant.
1430
+ *
1431
+ * Returns both tenant-specific tokens and global tokens.
1432
+ *
1433
+ * @param options - Filter options
1434
+ */
1435
+ listTokens(options?: {
1436
+ network?: string;
1437
+ include_global?: boolean;
1438
+ include_hidden?: boolean;
1439
+ }): Promise<Token[]>;
1440
+ /**
1441
+ * List global tokens (available to all tenants).
1442
+ *
1443
+ * These are well-known tokens like USDC, WETH, DAI, etc.
1444
+ */
1445
+ listGlobalTokens(network?: string): Promise<Token[]>;
1446
+ /**
1447
+ * Get a specific token by ID.
1448
+ */
1449
+ getToken(tokenId: string): Promise<Token>;
1450
+ /**
1451
+ * Get a token by contract address and network.
1452
+ */
1453
+ getTokenByContract(contractAddress: string, network: string): Promise<Token>;
1454
+ /**
1455
+ * Update a custom token.
1456
+ */
1457
+ updateToken(tokenId: string, request: UpdateTokenRequest): Promise<Token>;
1458
+ /**
1459
+ * Delete a custom token (soft delete).
1460
+ */
1461
+ deleteToken(tokenId: string): Promise<{
1462
+ message: string;
1463
+ token_id: string;
1464
+ }>;
1287
1465
  }
1288
1466
 
1289
1467
  /**
package/dist/index.js CHANGED
@@ -887,7 +887,9 @@ var WalletClient = class {
887
887
  // Balances
888
888
  // ---------------------------------------------------------------------------
889
889
  /**
890
- * Get wallet balance
890
+ * Get wallet balance including custom tokens.
891
+ *
892
+ * Returns native balance (ETH) plus all registered token balances.
891
893
  */
892
894
  async getBalance(walletId) {
893
895
  return this.http.get(`/wallets/${walletId}/balance`);
@@ -951,21 +953,33 @@ var WalletClient = class {
951
953
  // Token Transfers
952
954
  // ---------------------------------------------------------------------------
953
955
  /**
954
- * Transfer tokens from one address to another.
956
+ * Transfer tokens from a CDP wallet to any address.
957
+ *
958
+ * Supports native ETH and ERC-20 tokens. The source wallet must be a CDP-managed wallet.
955
959
  *
956
- * @param request - Transfer details
960
+ * @param request - Transfer details (use wallet_id or from_address)
957
961
  * @returns Transaction result with hash and status
958
962
  *
959
963
  * @example
960
964
  * ```typescript
965
+ * // Transfer ETH using wallet_id
961
966
  * const result = await client.wallets.transfer({
962
- * from_address: '0x123...',
967
+ * wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
963
968
  * to_address: '0x456...',
964
- * amount: '0.1',
969
+ * amount: '0.0001',
965
970
  * token: 'ETH',
966
- * network: 'base-sepolia',
971
+ * network: 'base-mainnet',
967
972
  * });
968
973
  * console.log('TX Hash:', result.tx_hash);
974
+ *
975
+ * // Transfer using from_address
976
+ * const result2 = await client.wallets.transfer({
977
+ * from_address: '0xaA2e82E5fCF97003d409Bc90826F40cfc8F27510',
978
+ * to_address: '0x456...',
979
+ * amount: '0.0001',
980
+ * token: 'ETH',
981
+ * network: 'base-mainnet',
982
+ * });
969
983
  * ```
970
984
  */
971
985
  async transfer(request) {
@@ -1007,6 +1021,108 @@ var WalletClient = class {
1007
1021
  async addNFT(walletId, nft) {
1008
1022
  return this.http.post(`/wallets/${walletId}/nfts`, nft);
1009
1023
  }
1024
+ // ---------------------------------------------------------------------------
1025
+ // Transaction History
1026
+ // ---------------------------------------------------------------------------
1027
+ /**
1028
+ * Get transaction history for a wallet.
1029
+ *
1030
+ * Returns both sent and received transactions including:
1031
+ * - Token transfers (ETH, ERC20)
1032
+ * - NFT transfers
1033
+ * - Contract interactions
1034
+ *
1035
+ * @param walletId - Wallet ID to query
1036
+ * @param options - Pagination options
1037
+ */
1038
+ async getTransactions(walletId, options = {}) {
1039
+ const params = new URLSearchParams();
1040
+ if (options.limit !== void 0) {
1041
+ params.set("limit", String(options.limit));
1042
+ }
1043
+ if (options.offset !== void 0) {
1044
+ params.set("offset", String(options.offset));
1045
+ }
1046
+ const query = params.toString();
1047
+ return this.http.get(
1048
+ `/wallets/${walletId}/transactions${query ? `?${query}` : ""}`
1049
+ );
1050
+ }
1051
+ // ---------------------------------------------------------------------------
1052
+ // Token Management
1053
+ // ---------------------------------------------------------------------------
1054
+ /**
1055
+ * Register a custom token for the tenant.
1056
+ *
1057
+ * This allows tracking balances and enabling transfers for custom ERC-20 tokens.
1058
+ *
1059
+ * @param request - Token details including contract address, symbol, decimals
1060
+ * @returns The created token
1061
+ *
1062
+ * @example
1063
+ * ```typescript
1064
+ * const token = await client.wallets.createToken({
1065
+ * contract_address: '0x...',
1066
+ * network: 'base-mainnet',
1067
+ * symbol: 'wSOL',
1068
+ * name: 'Wrapped Solana',
1069
+ * decimals: 9,
1070
+ * });
1071
+ * ```
1072
+ */
1073
+ async createToken(request) {
1074
+ return this.http.post("/tokens", request);
1075
+ }
1076
+ /**
1077
+ * List all tokens available to the tenant.
1078
+ *
1079
+ * Returns both tenant-specific tokens and global tokens.
1080
+ *
1081
+ * @param options - Filter options
1082
+ */
1083
+ async listTokens(options = {}) {
1084
+ const params = new URLSearchParams();
1085
+ if (options.network) params.set("network", options.network);
1086
+ if (options.include_global !== void 0) params.set("include_global", String(options.include_global));
1087
+ if (options.include_hidden !== void 0) params.set("include_hidden", String(options.include_hidden));
1088
+ const query = params.toString();
1089
+ return this.http.get(`/tokens${query ? `?${query}` : ""}`);
1090
+ }
1091
+ /**
1092
+ * List global tokens (available to all tenants).
1093
+ *
1094
+ * These are well-known tokens like USDC, WETH, DAI, etc.
1095
+ */
1096
+ async listGlobalTokens(network) {
1097
+ const params = network ? `?network=${network}` : "";
1098
+ return this.http.get(`/tokens/global${params}`);
1099
+ }
1100
+ /**
1101
+ * Get a specific token by ID.
1102
+ */
1103
+ async getToken(tokenId) {
1104
+ return this.http.get(`/tokens/${tokenId}`);
1105
+ }
1106
+ /**
1107
+ * Get a token by contract address and network.
1108
+ */
1109
+ async getTokenByContract(contractAddress, network) {
1110
+ return this.http.get(
1111
+ `/tokens/by-contract/${contractAddress}?network=${encodeURIComponent(network)}`
1112
+ );
1113
+ }
1114
+ /**
1115
+ * Update a custom token.
1116
+ */
1117
+ async updateToken(tokenId, request) {
1118
+ return this.http.patch(`/tokens/${tokenId}`, request);
1119
+ }
1120
+ /**
1121
+ * Delete a custom token (soft delete).
1122
+ */
1123
+ async deleteToken(tokenId) {
1124
+ return this.http.delete(`/tokens/${tokenId}`);
1125
+ }
1010
1126
  };
1011
1127
 
1012
1128
  // src/users.ts
package/dist/index.mjs CHANGED
@@ -835,7 +835,9 @@ var WalletClient = class {
835
835
  // Balances
836
836
  // ---------------------------------------------------------------------------
837
837
  /**
838
- * Get wallet balance
838
+ * Get wallet balance including custom tokens.
839
+ *
840
+ * Returns native balance (ETH) plus all registered token balances.
839
841
  */
840
842
  async getBalance(walletId) {
841
843
  return this.http.get(`/wallets/${walletId}/balance`);
@@ -899,21 +901,33 @@ var WalletClient = class {
899
901
  // Token Transfers
900
902
  // ---------------------------------------------------------------------------
901
903
  /**
902
- * Transfer tokens from one address to another.
904
+ * Transfer tokens from a CDP wallet to any address.
905
+ *
906
+ * Supports native ETH and ERC-20 tokens. The source wallet must be a CDP-managed wallet.
903
907
  *
904
- * @param request - Transfer details
908
+ * @param request - Transfer details (use wallet_id or from_address)
905
909
  * @returns Transaction result with hash and status
906
910
  *
907
911
  * @example
908
912
  * ```typescript
913
+ * // Transfer ETH using wallet_id
909
914
  * const result = await client.wallets.transfer({
910
- * from_address: '0x123...',
915
+ * wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
911
916
  * to_address: '0x456...',
912
- * amount: '0.1',
917
+ * amount: '0.0001',
913
918
  * token: 'ETH',
914
- * network: 'base-sepolia',
919
+ * network: 'base-mainnet',
915
920
  * });
916
921
  * console.log('TX Hash:', result.tx_hash);
922
+ *
923
+ * // Transfer using from_address
924
+ * const result2 = await client.wallets.transfer({
925
+ * from_address: '0xaA2e82E5fCF97003d409Bc90826F40cfc8F27510',
926
+ * to_address: '0x456...',
927
+ * amount: '0.0001',
928
+ * token: 'ETH',
929
+ * network: 'base-mainnet',
930
+ * });
917
931
  * ```
918
932
  */
919
933
  async transfer(request) {
@@ -955,6 +969,108 @@ var WalletClient = class {
955
969
  async addNFT(walletId, nft) {
956
970
  return this.http.post(`/wallets/${walletId}/nfts`, nft);
957
971
  }
972
+ // ---------------------------------------------------------------------------
973
+ // Transaction History
974
+ // ---------------------------------------------------------------------------
975
+ /**
976
+ * Get transaction history for a wallet.
977
+ *
978
+ * Returns both sent and received transactions including:
979
+ * - Token transfers (ETH, ERC20)
980
+ * - NFT transfers
981
+ * - Contract interactions
982
+ *
983
+ * @param walletId - Wallet ID to query
984
+ * @param options - Pagination options
985
+ */
986
+ async getTransactions(walletId, options = {}) {
987
+ const params = new URLSearchParams();
988
+ if (options.limit !== void 0) {
989
+ params.set("limit", String(options.limit));
990
+ }
991
+ if (options.offset !== void 0) {
992
+ params.set("offset", String(options.offset));
993
+ }
994
+ const query = params.toString();
995
+ return this.http.get(
996
+ `/wallets/${walletId}/transactions${query ? `?${query}` : ""}`
997
+ );
998
+ }
999
+ // ---------------------------------------------------------------------------
1000
+ // Token Management
1001
+ // ---------------------------------------------------------------------------
1002
+ /**
1003
+ * Register a custom token for the tenant.
1004
+ *
1005
+ * This allows tracking balances and enabling transfers for custom ERC-20 tokens.
1006
+ *
1007
+ * @param request - Token details including contract address, symbol, decimals
1008
+ * @returns The created token
1009
+ *
1010
+ * @example
1011
+ * ```typescript
1012
+ * const token = await client.wallets.createToken({
1013
+ * contract_address: '0x...',
1014
+ * network: 'base-mainnet',
1015
+ * symbol: 'wSOL',
1016
+ * name: 'Wrapped Solana',
1017
+ * decimals: 9,
1018
+ * });
1019
+ * ```
1020
+ */
1021
+ async createToken(request) {
1022
+ return this.http.post("/tokens", request);
1023
+ }
1024
+ /**
1025
+ * List all tokens available to the tenant.
1026
+ *
1027
+ * Returns both tenant-specific tokens and global tokens.
1028
+ *
1029
+ * @param options - Filter options
1030
+ */
1031
+ async listTokens(options = {}) {
1032
+ const params = new URLSearchParams();
1033
+ if (options.network) params.set("network", options.network);
1034
+ if (options.include_global !== void 0) params.set("include_global", String(options.include_global));
1035
+ if (options.include_hidden !== void 0) params.set("include_hidden", String(options.include_hidden));
1036
+ const query = params.toString();
1037
+ return this.http.get(`/tokens${query ? `?${query}` : ""}`);
1038
+ }
1039
+ /**
1040
+ * List global tokens (available to all tenants).
1041
+ *
1042
+ * These are well-known tokens like USDC, WETH, DAI, etc.
1043
+ */
1044
+ async listGlobalTokens(network) {
1045
+ const params = network ? `?network=${network}` : "";
1046
+ return this.http.get(`/tokens/global${params}`);
1047
+ }
1048
+ /**
1049
+ * Get a specific token by ID.
1050
+ */
1051
+ async getToken(tokenId) {
1052
+ return this.http.get(`/tokens/${tokenId}`);
1053
+ }
1054
+ /**
1055
+ * Get a token by contract address and network.
1056
+ */
1057
+ async getTokenByContract(contractAddress, network) {
1058
+ return this.http.get(
1059
+ `/tokens/by-contract/${contractAddress}?network=${encodeURIComponent(network)}`
1060
+ );
1061
+ }
1062
+ /**
1063
+ * Update a custom token.
1064
+ */
1065
+ async updateToken(tokenId, request) {
1066
+ return this.http.patch(`/tokens/${tokenId}`, request);
1067
+ }
1068
+ /**
1069
+ * Delete a custom token (soft delete).
1070
+ */
1071
+ async deleteToken(tokenId) {
1072
+ return this.http.delete(`/tokens/${tokenId}`);
1073
+ }
958
1074
  };
959
1075
 
960
1076
  // src/users.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofchain/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for ProofChain - blockchain-anchored document attestation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",