@proofchain/sdk 2.1.1 → 2.3.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 +196 -21
- package/dist/index.d.ts +196 -21
- package/dist/index.js +119 -13
- package/dist/index.mjs +119 -13
- package/package.json +1 -1
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;
|
|
@@ -1157,11 +1150,20 @@ interface AddNFTRequest {
|
|
|
1157
1150
|
source?: string;
|
|
1158
1151
|
}
|
|
1159
1152
|
interface TransferRequest {
|
|
1160
|
-
|
|
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 */
|
|
1161
1158
|
to_address: string;
|
|
1159
|
+
/** Amount to transfer (in token units, e.g., "0.1" for 0.1 ETH) */
|
|
1162
1160
|
amount: string;
|
|
1161
|
+
/** Token symbol (default: "ETH") */
|
|
1163
1162
|
token?: string;
|
|
1163
|
+
/** Network (default: "base-sepolia") */
|
|
1164
1164
|
network?: string;
|
|
1165
|
+
/** Contract address for custom ERC-20 tokens */
|
|
1166
|
+
contract_address?: string;
|
|
1165
1167
|
}
|
|
1166
1168
|
interface TransferResult {
|
|
1167
1169
|
tx_hash: string;
|
|
@@ -1169,9 +1171,80 @@ interface TransferResult {
|
|
|
1169
1171
|
to: string;
|
|
1170
1172
|
amount: string;
|
|
1171
1173
|
token: string;
|
|
1174
|
+
contract_address?: string;
|
|
1172
1175
|
network: string;
|
|
1173
1176
|
status: string;
|
|
1174
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
|
+
}
|
|
1175
1248
|
interface UserWithWallets {
|
|
1176
1249
|
user_id: string;
|
|
1177
1250
|
wallets: Array<{
|
|
@@ -1225,9 +1298,11 @@ declare class WalletClient {
|
|
|
1225
1298
|
*/
|
|
1226
1299
|
createDualBulk(userIds: string[], network?: string): Promise<DualWallets[]>;
|
|
1227
1300
|
/**
|
|
1228
|
-
* Get wallet balance
|
|
1301
|
+
* Get wallet balance including custom tokens.
|
|
1302
|
+
*
|
|
1303
|
+
* Returns native balance (ETH) plus all registered token balances.
|
|
1229
1304
|
*/
|
|
1230
|
-
getBalance(walletId: string): Promise<
|
|
1305
|
+
getBalance(walletId: string): Promise<WalletBalanceResponse>;
|
|
1231
1306
|
/**
|
|
1232
1307
|
* Get comprehensive wallet information in a single call.
|
|
1233
1308
|
*
|
|
@@ -1265,21 +1340,33 @@ declare class WalletClient {
|
|
|
1265
1340
|
warning: string;
|
|
1266
1341
|
}>;
|
|
1267
1342
|
/**
|
|
1268
|
-
* Transfer tokens from
|
|
1343
|
+
* Transfer tokens from a CDP wallet to any address.
|
|
1344
|
+
*
|
|
1345
|
+
* Supports native ETH and ERC-20 tokens. The source wallet must be a CDP-managed wallet.
|
|
1269
1346
|
*
|
|
1270
|
-
* @param request - Transfer details
|
|
1347
|
+
* @param request - Transfer details (use wallet_id or from_address)
|
|
1271
1348
|
* @returns Transaction result with hash and status
|
|
1272
1349
|
*
|
|
1273
1350
|
* @example
|
|
1274
1351
|
* ```typescript
|
|
1352
|
+
* // Transfer ETH using wallet_id
|
|
1275
1353
|
* const result = await client.wallets.transfer({
|
|
1276
|
-
*
|
|
1354
|
+
* wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
|
|
1277
1355
|
* to_address: '0x456...',
|
|
1278
|
-
* amount: '0.
|
|
1356
|
+
* amount: '0.0001',
|
|
1279
1357
|
* token: 'ETH',
|
|
1280
|
-
* network: 'base-
|
|
1358
|
+
* network: 'base-mainnet',
|
|
1281
1359
|
* });
|
|
1282
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
|
+
* });
|
|
1283
1370
|
* ```
|
|
1284
1371
|
*/
|
|
1285
1372
|
transfer(request: TransferRequest): Promise<TransferResult>;
|
|
@@ -1318,6 +1405,63 @@ declare class WalletClient {
|
|
|
1318
1405
|
limit?: number;
|
|
1319
1406
|
offset?: number;
|
|
1320
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
|
+
}>;
|
|
1321
1465
|
}
|
|
1322
1466
|
|
|
1323
1467
|
/**
|
|
@@ -1714,15 +1858,27 @@ interface UserQuestProgress {
|
|
|
1714
1858
|
user_id: string;
|
|
1715
1859
|
quest_id: string;
|
|
1716
1860
|
quest_name: string;
|
|
1717
|
-
status: 'not_started' | 'in_progress' | 'completed' | 'failed' | 'expired';
|
|
1861
|
+
status: 'not_started' | 'in_progress' | 'completed' | 'failed' | 'expired' | 'reward_pending';
|
|
1718
1862
|
started_at?: string;
|
|
1719
1863
|
completed_at?: string;
|
|
1720
1864
|
expires_at?: string;
|
|
1721
1865
|
completion_count: number;
|
|
1722
1866
|
current_step_order: number;
|
|
1867
|
+
steps_completed: number;
|
|
1868
|
+
total_steps: number;
|
|
1869
|
+
completion_percentage: number;
|
|
1723
1870
|
step_progress: StepProgress[];
|
|
1724
1871
|
points_earned: number;
|
|
1725
|
-
reward_earned
|
|
1872
|
+
reward_earned?: RewardEarned;
|
|
1873
|
+
}
|
|
1874
|
+
interface RewardEarned {
|
|
1875
|
+
id: string;
|
|
1876
|
+
reward_name: string;
|
|
1877
|
+
reward_type: string;
|
|
1878
|
+
value?: number;
|
|
1879
|
+
value_currency?: string;
|
|
1880
|
+
status: string;
|
|
1881
|
+
earned_at: string;
|
|
1726
1882
|
}
|
|
1727
1883
|
interface StepProgress {
|
|
1728
1884
|
step_id: string;
|
|
@@ -1732,6 +1888,14 @@ interface StepProgress {
|
|
|
1732
1888
|
completed_at?: string;
|
|
1733
1889
|
event_id?: string;
|
|
1734
1890
|
}
|
|
1891
|
+
interface StepCompletionResult {
|
|
1892
|
+
step_index: number;
|
|
1893
|
+
step_completed: boolean;
|
|
1894
|
+
quest_completed: boolean;
|
|
1895
|
+
current_count: number;
|
|
1896
|
+
target_count: number;
|
|
1897
|
+
points_earned: number;
|
|
1898
|
+
}
|
|
1735
1899
|
interface QuestWithProgress extends Quest {
|
|
1736
1900
|
user_progress?: UserQuestProgress;
|
|
1737
1901
|
}
|
|
@@ -1794,6 +1958,13 @@ declare class QuestsClient {
|
|
|
1794
1958
|
* Get a quest by ID
|
|
1795
1959
|
*/
|
|
1796
1960
|
get(questId: string): Promise<Quest>;
|
|
1961
|
+
/**
|
|
1962
|
+
* List available quests for a user (active, public quests with user progress)
|
|
1963
|
+
* This is the main endpoint for frontend quest displays
|
|
1964
|
+
*/
|
|
1965
|
+
listAvailable(userId: string, options?: {
|
|
1966
|
+
category?: string;
|
|
1967
|
+
}): Promise<QuestWithProgress[]>;
|
|
1797
1968
|
/**
|
|
1798
1969
|
* Get a quest by slug
|
|
1799
1970
|
*/
|
|
@@ -1811,7 +1982,11 @@ declare class QuestsClient {
|
|
|
1811
1982
|
*/
|
|
1812
1983
|
delete(questId: string): Promise<void>;
|
|
1813
1984
|
/**
|
|
1814
|
-
*
|
|
1985
|
+
* Publish/activate a quest (changes status from draft to active)
|
|
1986
|
+
*/
|
|
1987
|
+
publish(questId: string): Promise<Quest>;
|
|
1988
|
+
/**
|
|
1989
|
+
* @deprecated Use publish() instead
|
|
1815
1990
|
*/
|
|
1816
1991
|
activate(questId: string): Promise<Quest>;
|
|
1817
1992
|
/**
|
|
@@ -1839,9 +2014,9 @@ declare class QuestsClient {
|
|
|
1839
2014
|
*/
|
|
1840
2015
|
getUserProgress(questId: string, userId: string): Promise<UserQuestProgress>;
|
|
1841
2016
|
/**
|
|
1842
|
-
* Complete a step manually
|
|
2017
|
+
* Complete a step manually by step index
|
|
1843
2018
|
*/
|
|
1844
|
-
completeStep(questId: string, userId: string,
|
|
2019
|
+
completeStep(questId: string, userId: string, stepIndex: number): Promise<StepCompletionResult>;
|
|
1845
2020
|
/**
|
|
1846
2021
|
* Get all quest progress for a user
|
|
1847
2022
|
*/
|
|
@@ -2609,4 +2784,4 @@ declare class TimeoutError extends ProofChainError {
|
|
|
2609
2784
|
constructor(message?: string);
|
|
2610
2785
|
}
|
|
2611
2786
|
|
|
2612
|
-
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
|
|
2787
|
+
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
|
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;
|
|
@@ -1157,11 +1150,20 @@ interface AddNFTRequest {
|
|
|
1157
1150
|
source?: string;
|
|
1158
1151
|
}
|
|
1159
1152
|
interface TransferRequest {
|
|
1160
|
-
|
|
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 */
|
|
1161
1158
|
to_address: string;
|
|
1159
|
+
/** Amount to transfer (in token units, e.g., "0.1" for 0.1 ETH) */
|
|
1162
1160
|
amount: string;
|
|
1161
|
+
/** Token symbol (default: "ETH") */
|
|
1163
1162
|
token?: string;
|
|
1163
|
+
/** Network (default: "base-sepolia") */
|
|
1164
1164
|
network?: string;
|
|
1165
|
+
/** Contract address for custom ERC-20 tokens */
|
|
1166
|
+
contract_address?: string;
|
|
1165
1167
|
}
|
|
1166
1168
|
interface TransferResult {
|
|
1167
1169
|
tx_hash: string;
|
|
@@ -1169,9 +1171,80 @@ interface TransferResult {
|
|
|
1169
1171
|
to: string;
|
|
1170
1172
|
amount: string;
|
|
1171
1173
|
token: string;
|
|
1174
|
+
contract_address?: string;
|
|
1172
1175
|
network: string;
|
|
1173
1176
|
status: string;
|
|
1174
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
|
+
}
|
|
1175
1248
|
interface UserWithWallets {
|
|
1176
1249
|
user_id: string;
|
|
1177
1250
|
wallets: Array<{
|
|
@@ -1225,9 +1298,11 @@ declare class WalletClient {
|
|
|
1225
1298
|
*/
|
|
1226
1299
|
createDualBulk(userIds: string[], network?: string): Promise<DualWallets[]>;
|
|
1227
1300
|
/**
|
|
1228
|
-
* Get wallet balance
|
|
1301
|
+
* Get wallet balance including custom tokens.
|
|
1302
|
+
*
|
|
1303
|
+
* Returns native balance (ETH) plus all registered token balances.
|
|
1229
1304
|
*/
|
|
1230
|
-
getBalance(walletId: string): Promise<
|
|
1305
|
+
getBalance(walletId: string): Promise<WalletBalanceResponse>;
|
|
1231
1306
|
/**
|
|
1232
1307
|
* Get comprehensive wallet information in a single call.
|
|
1233
1308
|
*
|
|
@@ -1265,21 +1340,33 @@ declare class WalletClient {
|
|
|
1265
1340
|
warning: string;
|
|
1266
1341
|
}>;
|
|
1267
1342
|
/**
|
|
1268
|
-
* Transfer tokens from
|
|
1343
|
+
* Transfer tokens from a CDP wallet to any address.
|
|
1344
|
+
*
|
|
1345
|
+
* Supports native ETH and ERC-20 tokens. The source wallet must be a CDP-managed wallet.
|
|
1269
1346
|
*
|
|
1270
|
-
* @param request - Transfer details
|
|
1347
|
+
* @param request - Transfer details (use wallet_id or from_address)
|
|
1271
1348
|
* @returns Transaction result with hash and status
|
|
1272
1349
|
*
|
|
1273
1350
|
* @example
|
|
1274
1351
|
* ```typescript
|
|
1352
|
+
* // Transfer ETH using wallet_id
|
|
1275
1353
|
* const result = await client.wallets.transfer({
|
|
1276
|
-
*
|
|
1354
|
+
* wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
|
|
1277
1355
|
* to_address: '0x456...',
|
|
1278
|
-
* amount: '0.
|
|
1356
|
+
* amount: '0.0001',
|
|
1279
1357
|
* token: 'ETH',
|
|
1280
|
-
* network: 'base-
|
|
1358
|
+
* network: 'base-mainnet',
|
|
1281
1359
|
* });
|
|
1282
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
|
+
* });
|
|
1283
1370
|
* ```
|
|
1284
1371
|
*/
|
|
1285
1372
|
transfer(request: TransferRequest): Promise<TransferResult>;
|
|
@@ -1318,6 +1405,63 @@ declare class WalletClient {
|
|
|
1318
1405
|
limit?: number;
|
|
1319
1406
|
offset?: number;
|
|
1320
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
|
+
}>;
|
|
1321
1465
|
}
|
|
1322
1466
|
|
|
1323
1467
|
/**
|
|
@@ -1714,15 +1858,27 @@ interface UserQuestProgress {
|
|
|
1714
1858
|
user_id: string;
|
|
1715
1859
|
quest_id: string;
|
|
1716
1860
|
quest_name: string;
|
|
1717
|
-
status: 'not_started' | 'in_progress' | 'completed' | 'failed' | 'expired';
|
|
1861
|
+
status: 'not_started' | 'in_progress' | 'completed' | 'failed' | 'expired' | 'reward_pending';
|
|
1718
1862
|
started_at?: string;
|
|
1719
1863
|
completed_at?: string;
|
|
1720
1864
|
expires_at?: string;
|
|
1721
1865
|
completion_count: number;
|
|
1722
1866
|
current_step_order: number;
|
|
1867
|
+
steps_completed: number;
|
|
1868
|
+
total_steps: number;
|
|
1869
|
+
completion_percentage: number;
|
|
1723
1870
|
step_progress: StepProgress[];
|
|
1724
1871
|
points_earned: number;
|
|
1725
|
-
reward_earned
|
|
1872
|
+
reward_earned?: RewardEarned;
|
|
1873
|
+
}
|
|
1874
|
+
interface RewardEarned {
|
|
1875
|
+
id: string;
|
|
1876
|
+
reward_name: string;
|
|
1877
|
+
reward_type: string;
|
|
1878
|
+
value?: number;
|
|
1879
|
+
value_currency?: string;
|
|
1880
|
+
status: string;
|
|
1881
|
+
earned_at: string;
|
|
1726
1882
|
}
|
|
1727
1883
|
interface StepProgress {
|
|
1728
1884
|
step_id: string;
|
|
@@ -1732,6 +1888,14 @@ interface StepProgress {
|
|
|
1732
1888
|
completed_at?: string;
|
|
1733
1889
|
event_id?: string;
|
|
1734
1890
|
}
|
|
1891
|
+
interface StepCompletionResult {
|
|
1892
|
+
step_index: number;
|
|
1893
|
+
step_completed: boolean;
|
|
1894
|
+
quest_completed: boolean;
|
|
1895
|
+
current_count: number;
|
|
1896
|
+
target_count: number;
|
|
1897
|
+
points_earned: number;
|
|
1898
|
+
}
|
|
1735
1899
|
interface QuestWithProgress extends Quest {
|
|
1736
1900
|
user_progress?: UserQuestProgress;
|
|
1737
1901
|
}
|
|
@@ -1794,6 +1958,13 @@ declare class QuestsClient {
|
|
|
1794
1958
|
* Get a quest by ID
|
|
1795
1959
|
*/
|
|
1796
1960
|
get(questId: string): Promise<Quest>;
|
|
1961
|
+
/**
|
|
1962
|
+
* List available quests for a user (active, public quests with user progress)
|
|
1963
|
+
* This is the main endpoint for frontend quest displays
|
|
1964
|
+
*/
|
|
1965
|
+
listAvailable(userId: string, options?: {
|
|
1966
|
+
category?: string;
|
|
1967
|
+
}): Promise<QuestWithProgress[]>;
|
|
1797
1968
|
/**
|
|
1798
1969
|
* Get a quest by slug
|
|
1799
1970
|
*/
|
|
@@ -1811,7 +1982,11 @@ declare class QuestsClient {
|
|
|
1811
1982
|
*/
|
|
1812
1983
|
delete(questId: string): Promise<void>;
|
|
1813
1984
|
/**
|
|
1814
|
-
*
|
|
1985
|
+
* Publish/activate a quest (changes status from draft to active)
|
|
1986
|
+
*/
|
|
1987
|
+
publish(questId: string): Promise<Quest>;
|
|
1988
|
+
/**
|
|
1989
|
+
* @deprecated Use publish() instead
|
|
1815
1990
|
*/
|
|
1816
1991
|
activate(questId: string): Promise<Quest>;
|
|
1817
1992
|
/**
|
|
@@ -1839,9 +2014,9 @@ declare class QuestsClient {
|
|
|
1839
2014
|
*/
|
|
1840
2015
|
getUserProgress(questId: string, userId: string): Promise<UserQuestProgress>;
|
|
1841
2016
|
/**
|
|
1842
|
-
* Complete a step manually
|
|
2017
|
+
* Complete a step manually by step index
|
|
1843
2018
|
*/
|
|
1844
|
-
completeStep(questId: string, userId: string,
|
|
2019
|
+
completeStep(questId: string, userId: string, stepIndex: number): Promise<StepCompletionResult>;
|
|
1845
2020
|
/**
|
|
1846
2021
|
* Get all quest progress for a user
|
|
1847
2022
|
*/
|
|
@@ -2609,4 +2784,4 @@ declare class TimeoutError extends ProofChainError {
|
|
|
2609
2784
|
constructor(message?: string);
|
|
2610
2785
|
}
|
|
2611
2786
|
|
|
2612
|
-
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
|
|
2787
|
+
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
|
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
|
|
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
|
-
*
|
|
967
|
+
* wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
|
|
963
968
|
* to_address: '0x456...',
|
|
964
|
-
* amount: '0.
|
|
969
|
+
* amount: '0.0001',
|
|
965
970
|
* token: 'ETH',
|
|
966
|
-
* network: 'base-
|
|
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) {
|
|
@@ -1034,6 +1048,81 @@ var WalletClient = class {
|
|
|
1034
1048
|
`/wallets/${walletId}/transactions${query ? `?${query}` : ""}`
|
|
1035
1049
|
);
|
|
1036
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
|
+
}
|
|
1037
1126
|
};
|
|
1038
1127
|
|
|
1039
1128
|
// src/users.ts
|
|
@@ -1282,6 +1371,16 @@ var QuestsClient = class {
|
|
|
1282
1371
|
async get(questId) {
|
|
1283
1372
|
return this.http.get(`/quests/${questId}`);
|
|
1284
1373
|
}
|
|
1374
|
+
/**
|
|
1375
|
+
* List available quests for a user (active, public quests with user progress)
|
|
1376
|
+
* This is the main endpoint for frontend quest displays
|
|
1377
|
+
*/
|
|
1378
|
+
async listAvailable(userId, options = {}) {
|
|
1379
|
+
const params = new URLSearchParams();
|
|
1380
|
+
params.append("user_id", userId);
|
|
1381
|
+
if (options.category) params.append("category", options.category);
|
|
1382
|
+
return this.http.get(`/quests/available?${params.toString()}`);
|
|
1383
|
+
}
|
|
1285
1384
|
/**
|
|
1286
1385
|
* Get a quest by slug
|
|
1287
1386
|
*/
|
|
@@ -1310,10 +1409,16 @@ var QuestsClient = class {
|
|
|
1310
1409
|
// Quest Status
|
|
1311
1410
|
// ---------------------------------------------------------------------------
|
|
1312
1411
|
/**
|
|
1313
|
-
*
|
|
1412
|
+
* Publish/activate a quest (changes status from draft to active)
|
|
1413
|
+
*/
|
|
1414
|
+
async publish(questId) {
|
|
1415
|
+
return this.http.post(`/quests/${questId}/publish`, {});
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* @deprecated Use publish() instead
|
|
1314
1419
|
*/
|
|
1315
1420
|
async activate(questId) {
|
|
1316
|
-
return this.
|
|
1421
|
+
return this.publish(questId);
|
|
1317
1422
|
}
|
|
1318
1423
|
/**
|
|
1319
1424
|
* Pause a quest
|
|
@@ -1359,12 +1464,13 @@ var QuestsClient = class {
|
|
|
1359
1464
|
return this.http.get(`/quests/${questId}/progress/${encodeURIComponent(userId)}`);
|
|
1360
1465
|
}
|
|
1361
1466
|
/**
|
|
1362
|
-
* Complete a step manually
|
|
1467
|
+
* Complete a step manually by step index
|
|
1363
1468
|
*/
|
|
1364
|
-
async completeStep(questId, userId,
|
|
1365
|
-
return this.http.post(
|
|
1366
|
-
|
|
1367
|
-
|
|
1469
|
+
async completeStep(questId, userId, stepIndex) {
|
|
1470
|
+
return this.http.post(
|
|
1471
|
+
`/quests/${questId}/progress/${encodeURIComponent(userId)}/step/${stepIndex}/complete`,
|
|
1472
|
+
{}
|
|
1473
|
+
);
|
|
1368
1474
|
}
|
|
1369
1475
|
/**
|
|
1370
1476
|
* Get all quest progress for a user
|
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
|
|
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
|
-
*
|
|
915
|
+
* wallet_id: 'd1096269-f986-4fa6-a1f5-1a29ef69f6e4',
|
|
911
916
|
* to_address: '0x456...',
|
|
912
|
-
* amount: '0.
|
|
917
|
+
* amount: '0.0001',
|
|
913
918
|
* token: 'ETH',
|
|
914
|
-
* network: 'base-
|
|
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) {
|
|
@@ -982,6 +996,81 @@ var WalletClient = class {
|
|
|
982
996
|
`/wallets/${walletId}/transactions${query ? `?${query}` : ""}`
|
|
983
997
|
);
|
|
984
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
|
+
}
|
|
985
1074
|
};
|
|
986
1075
|
|
|
987
1076
|
// src/users.ts
|
|
@@ -1230,6 +1319,16 @@ var QuestsClient = class {
|
|
|
1230
1319
|
async get(questId) {
|
|
1231
1320
|
return this.http.get(`/quests/${questId}`);
|
|
1232
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* List available quests for a user (active, public quests with user progress)
|
|
1324
|
+
* This is the main endpoint for frontend quest displays
|
|
1325
|
+
*/
|
|
1326
|
+
async listAvailable(userId, options = {}) {
|
|
1327
|
+
const params = new URLSearchParams();
|
|
1328
|
+
params.append("user_id", userId);
|
|
1329
|
+
if (options.category) params.append("category", options.category);
|
|
1330
|
+
return this.http.get(`/quests/available?${params.toString()}`);
|
|
1331
|
+
}
|
|
1233
1332
|
/**
|
|
1234
1333
|
* Get a quest by slug
|
|
1235
1334
|
*/
|
|
@@ -1258,10 +1357,16 @@ var QuestsClient = class {
|
|
|
1258
1357
|
// Quest Status
|
|
1259
1358
|
// ---------------------------------------------------------------------------
|
|
1260
1359
|
/**
|
|
1261
|
-
*
|
|
1360
|
+
* Publish/activate a quest (changes status from draft to active)
|
|
1361
|
+
*/
|
|
1362
|
+
async publish(questId) {
|
|
1363
|
+
return this.http.post(`/quests/${questId}/publish`, {});
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* @deprecated Use publish() instead
|
|
1262
1367
|
*/
|
|
1263
1368
|
async activate(questId) {
|
|
1264
|
-
return this.
|
|
1369
|
+
return this.publish(questId);
|
|
1265
1370
|
}
|
|
1266
1371
|
/**
|
|
1267
1372
|
* Pause a quest
|
|
@@ -1307,12 +1412,13 @@ var QuestsClient = class {
|
|
|
1307
1412
|
return this.http.get(`/quests/${questId}/progress/${encodeURIComponent(userId)}`);
|
|
1308
1413
|
}
|
|
1309
1414
|
/**
|
|
1310
|
-
* Complete a step manually
|
|
1415
|
+
* Complete a step manually by step index
|
|
1311
1416
|
*/
|
|
1312
|
-
async completeStep(questId, userId,
|
|
1313
|
-
return this.http.post(
|
|
1314
|
-
|
|
1315
|
-
|
|
1417
|
+
async completeStep(questId, userId, stepIndex) {
|
|
1418
|
+
return this.http.post(
|
|
1419
|
+
`/quests/${questId}/progress/${encodeURIComponent(userId)}/step/${stepIndex}/complete`,
|
|
1420
|
+
{}
|
|
1421
|
+
);
|
|
1316
1422
|
}
|
|
1317
1423
|
/**
|
|
1318
1424
|
* Get all quest progress for a user
|
package/package.json
CHANGED