@chipi-stack/types 14.13.1 → 14.14.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
@@ -541,7 +541,7 @@ interface SignTypedDataResult {
541
541
  s: string;
542
542
  }
543
543
  /**
544
- * Parameters for syncing on-chain transactions from Voyager.
544
+ * Parameters for syncing a wallet's on-chain transfers (read from Starknet events by the backend).
545
545
  */
546
546
  interface SyncOnChainTransfersParams {
547
547
  /** Wallet address to sync transfers for */
@@ -829,6 +829,19 @@ interface AddSessionKeyParams {
829
829
  /** Session configuration to register on-chain */
830
830
  sessionConfig: SessionConfig;
831
831
  }
832
+ /**
833
+ * A spending policy for the session being set up. The session public key is
834
+ * taken from `sessionConfig`, so it is omitted here.
835
+ */
836
+ type SessionSpendingPolicy = Omit<SpendingPolicyConfig, "sessionPublicKey">;
837
+ /**
838
+ * Parameters for registering a session and its spending policies in one
839
+ * owner-signed transaction (`sdk.sessions.setupSession`).
840
+ */
841
+ interface SetupSessionParams extends AddSessionKeyParams {
842
+ /** One policy per token the session may spend. Applied after registration, in order. */
843
+ spendingPolicies?: SessionSpendingPolicy[];
844
+ }
832
845
  /**
833
846
  * Parameters for executing a transaction using a session key.
834
847
  * Uses session signature (4-element format) instead of owner signature.
@@ -1131,6 +1144,247 @@ interface X402PaymentConfig {
1131
1144
  description?: string;
1132
1145
  }
1133
1146
 
1147
+ /**
1148
+ * Types for the Chipi AI API (`/v1/ai/*`), used by `sdk.ai` in
1149
+ * `@chipi-stack/backend`. Every call is billed to the organization's credits
1150
+ * and needs a secret key (`sk_`), so these are server-side only.
1151
+ */
1152
+ /** Actions `/v1/ai/think` may decide. */
1153
+ type ThinkAction = "swap" | "supply" | "withdraw" | "hold";
1154
+ /**
1155
+ * A structured decision from `/v1/ai/think`.
1156
+ *
1157
+ * `from` / `to` are token symbols. For `supply` / `withdraw`, `to` names the
1158
+ * pool with its protocol (e.g. `"vesu_usdc"`). `amount` is in portfolio units
1159
+ * as the model understood them: validate it against your own limits before
1160
+ * acting on it.
1161
+ */
1162
+ interface ThinkDecision {
1163
+ action: ThinkAction;
1164
+ from?: string;
1165
+ to?: string;
1166
+ amount?: number;
1167
+ reason: string;
1168
+ /** 0-1 */
1169
+ confidence?: number;
1170
+ }
1171
+ /**
1172
+ * What the model returned when it was not valid JSON. The call is still billed.
1173
+ * Treat it as `hold`.
1174
+ */
1175
+ interface ThinkRawDecision {
1176
+ raw: string;
1177
+ }
1178
+ /** Risk parameters `/v1/ai/think` applied (your overrides plus the defaults derived from `riskScore`). */
1179
+ interface ThinkRiskParams {
1180
+ /** 1-10 */
1181
+ riskScore: number;
1182
+ maxSingleTradePercent: number;
1183
+ minStablecoinPercent: number;
1184
+ maxDrawdownPercent: number;
1185
+ minSignalStrength: number;
1186
+ minExpectedGainPercent: number;
1187
+ }
1188
+ interface AiUsage {
1189
+ inputTokens: number;
1190
+ outputTokens: number;
1191
+ totalTokens: number;
1192
+ }
1193
+ interface AiCost {
1194
+ /** Amount debited from the organization's credits */
1195
+ charged: number;
1196
+ currency: "USD";
1197
+ }
1198
+ interface ThinkParams extends Partial<Omit<ThinkRiskParams, "riskScore">> {
1199
+ /** Your portfolio, in any JSON shape the model can read (balances, positions, prices). */
1200
+ portfolio: Record<string, unknown>;
1201
+ /** 1-10, clamped by the API. Default 5. */
1202
+ riskScore?: number;
1203
+ /** Model id from `sdk.ai.models()`. Default: the API default. */
1204
+ model?: string;
1205
+ /** Default `"starknet"`. Selects which market signals are injected into the prompt. */
1206
+ chain?: string;
1207
+ history?: {
1208
+ recentDecisions?: number;
1209
+ };
1210
+ }
1211
+ interface ThinkResponse {
1212
+ /** Check with `isThinkDecision` before acting on it. */
1213
+ decision: ThinkDecision | ThinkRawDecision;
1214
+ riskParams: ThinkRiskParams;
1215
+ model: string;
1216
+ provider: string;
1217
+ usage: AiUsage;
1218
+ cost: AiCost;
1219
+ latencyMs: number;
1220
+ /** `true` only for `sk_dev_` keys: canned response, no model was called. */
1221
+ sandbox?: boolean;
1222
+ }
1223
+ interface AiChatMessage {
1224
+ role: "system" | "user" | "assistant";
1225
+ content: string;
1226
+ }
1227
+ interface AiChatParams {
1228
+ messages: AiChatMessage[];
1229
+ model?: string;
1230
+ /** Clamped to the model's accepted range by the API. Default 4096. */
1231
+ max_tokens?: number;
1232
+ }
1233
+ interface AiChatResponse {
1234
+ text: string;
1235
+ model: string;
1236
+ provider: string;
1237
+ usage: AiUsage;
1238
+ cost: AiCost;
1239
+ finishReason: string;
1240
+ latencyMs: number;
1241
+ sandbox?: boolean;
1242
+ }
1243
+ /** Only `swap` on `starknet` today. */
1244
+ interface AiExecuteParams {
1245
+ chain: "starknet";
1246
+ action: "swap";
1247
+ /** Token symbol to sell, e.g. `"USDC"` */
1248
+ from: string;
1249
+ /** Token symbol to buy, e.g. `"ETH"` */
1250
+ to: string;
1251
+ /** Must be > 0 */
1252
+ amountUsd: number;
1253
+ /** The wallet that will sign and send the returned calls */
1254
+ walletAddress: string;
1255
+ /** 0 < slippage < 0.5 (0.005 = 0.5%) */
1256
+ slippage?: number;
1257
+ }
1258
+ interface AiExecuteCall {
1259
+ contractAddress: string;
1260
+ entrypoint: string;
1261
+ calldata: string[];
1262
+ }
1263
+ interface AiSwapQuote {
1264
+ sellToken: string;
1265
+ buyToken: string;
1266
+ /** Raw amount in the sell token's decimals */
1267
+ sellAmount: string;
1268
+ /** Raw amount in the buy token's decimals */
1269
+ buyAmount: string;
1270
+ sellAmountUsd: number;
1271
+ buyAmountUsd: number;
1272
+ /** Percent */
1273
+ priceImpactPct: number;
1274
+ route: string;
1275
+ }
1276
+ /**
1277
+ * Unsigned calls (approve + swap). Nothing is submitted: sign and send them
1278
+ * with a session key or the owner's key.
1279
+ */
1280
+ interface AiExecuteResponse {
1281
+ calls: AiExecuteCall[];
1282
+ quote: AiSwapQuote;
1283
+ cost: AiCost;
1284
+ sandbox?: boolean;
1285
+ }
1286
+ interface AiSignalsParams {
1287
+ /** Symbols, e.g. `["ETH", "STRK"]`. Default: every tracked token. */
1288
+ tokens?: string[];
1289
+ /** Filters `yields` by chain */
1290
+ chain?: string;
1291
+ }
1292
+ interface AiTokenSignals {
1293
+ rsi14: number | null;
1294
+ macd: {
1295
+ value: number;
1296
+ signal: number;
1297
+ histogram: number;
1298
+ } | null;
1299
+ bollingerBands: {
1300
+ upper: number;
1301
+ middle: number;
1302
+ lower: number;
1303
+ } | null;
1304
+ ema: {
1305
+ ema20: number | null;
1306
+ ema50: number | null;
1307
+ ema200: number | null;
1308
+ };
1309
+ trend: "oversold" | "overbought" | "bullish" | "bearish" | "neutral";
1310
+ /** 0-1 */
1311
+ signalStrength: number;
1312
+ }
1313
+ interface AiSignals {
1314
+ tokens: Record<string, AiTokenSignals>;
1315
+ market: {
1316
+ fearGreedIndex: number | null;
1317
+ fearGreedLabel: string | null;
1318
+ };
1319
+ yields: Array<{
1320
+ pool: string;
1321
+ protocol: string;
1322
+ chain: string;
1323
+ apy: number;
1324
+ tvlUsd: number;
1325
+ }>;
1326
+ /** Plain-language definitions of every field */
1327
+ definitions: Record<string, string>;
1328
+ meta: {
1329
+ sources: string[];
1330
+ snapshotsUsed: number;
1331
+ updatedAt: string;
1332
+ };
1333
+ }
1334
+ interface AiPricesParams {
1335
+ /** Symbols, e.g. `["ETH", "STRK"]` (case-insensitive). Default: every tracked token. */
1336
+ tokens?: string[];
1337
+ /** Only tokens listed on this chain, e.g. `"starknet"`. */
1338
+ chain?: string;
1339
+ }
1340
+ interface AiTokenPrice {
1341
+ /** USD */
1342
+ price: number;
1343
+ change1h: number | null;
1344
+ change24h: number | null;
1345
+ change7d: number | null;
1346
+ high24h: number | null;
1347
+ low24h: number | null;
1348
+ marketCap: number | null;
1349
+ marketCapRank: number | null;
1350
+ volume24h: number | null;
1351
+ ath: number | null;
1352
+ athDate: string | null;
1353
+ circulatingSupply: number | null;
1354
+ image: string | null;
1355
+ chains: string[];
1356
+ }
1357
+ interface AiPrices {
1358
+ /** Keyed by symbol as the registry spells it (e.g. `"ETH"`, `"tBTC"`). */
1359
+ tokens: Record<string, AiTokenPrice>;
1360
+ meta: {
1361
+ totalTokens: number;
1362
+ source: string;
1363
+ refreshInterval: number;
1364
+ updatedAt: string;
1365
+ filteredBy?: Record<string, string>;
1366
+ };
1367
+ }
1368
+ interface AiModel {
1369
+ id: string;
1370
+ provider: string;
1371
+ displayName: string;
1372
+ pricing: {
1373
+ inputPer1MTokens: number;
1374
+ outputPer1MTokens: number;
1375
+ currency: "USD";
1376
+ };
1377
+ limits: {
1378
+ maxOutputTokens: number;
1379
+ providerRPM: number;
1380
+ };
1381
+ }
1382
+ interface AiModelsResponse {
1383
+ models: AiModel[];
1384
+ default: string;
1385
+ margin: string;
1386
+ }
1387
+
1134
1388
  /**
1135
1389
  * Plus epic — shared subscription state types.
1136
1390
  *
@@ -1167,4 +1421,4 @@ interface PlanSnapshot {
1167
1421
  planPaymentProvider: PlanPaymentProvider | null;
1168
1422
  }
1169
1423
 
1170
- export { type AddSessionKeyParams, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
1424
+ export { type AddSessionKeyParams, type AiChatMessage, type AiChatParams, type AiChatResponse, type AiCost, type AiExecuteCall, type AiExecuteParams, type AiExecuteResponse, type AiModel, type AiModelsResponse, type AiPrices, type AiPricesParams, type AiSignals, type AiSignalsParams, type AiSwapQuote, type AiTokenPrice, type AiTokenSignals, type AiUsage, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionSpendingPolicy, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type SetupSessionParams, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type ThinkAction, type ThinkDecision, type ThinkParams, type ThinkRawDecision, type ThinkResponse, type ThinkRiskParams, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
package/dist/index.d.ts CHANGED
@@ -541,7 +541,7 @@ interface SignTypedDataResult {
541
541
  s: string;
542
542
  }
543
543
  /**
544
- * Parameters for syncing on-chain transactions from Voyager.
544
+ * Parameters for syncing a wallet's on-chain transfers (read from Starknet events by the backend).
545
545
  */
546
546
  interface SyncOnChainTransfersParams {
547
547
  /** Wallet address to sync transfers for */
@@ -829,6 +829,19 @@ interface AddSessionKeyParams {
829
829
  /** Session configuration to register on-chain */
830
830
  sessionConfig: SessionConfig;
831
831
  }
832
+ /**
833
+ * A spending policy for the session being set up. The session public key is
834
+ * taken from `sessionConfig`, so it is omitted here.
835
+ */
836
+ type SessionSpendingPolicy = Omit<SpendingPolicyConfig, "sessionPublicKey">;
837
+ /**
838
+ * Parameters for registering a session and its spending policies in one
839
+ * owner-signed transaction (`sdk.sessions.setupSession`).
840
+ */
841
+ interface SetupSessionParams extends AddSessionKeyParams {
842
+ /** One policy per token the session may spend. Applied after registration, in order. */
843
+ spendingPolicies?: SessionSpendingPolicy[];
844
+ }
832
845
  /**
833
846
  * Parameters for executing a transaction using a session key.
834
847
  * Uses session signature (4-element format) instead of owner signature.
@@ -1131,6 +1144,247 @@ interface X402PaymentConfig {
1131
1144
  description?: string;
1132
1145
  }
1133
1146
 
1147
+ /**
1148
+ * Types for the Chipi AI API (`/v1/ai/*`), used by `sdk.ai` in
1149
+ * `@chipi-stack/backend`. Every call is billed to the organization's credits
1150
+ * and needs a secret key (`sk_`), so these are server-side only.
1151
+ */
1152
+ /** Actions `/v1/ai/think` may decide. */
1153
+ type ThinkAction = "swap" | "supply" | "withdraw" | "hold";
1154
+ /**
1155
+ * A structured decision from `/v1/ai/think`.
1156
+ *
1157
+ * `from` / `to` are token symbols. For `supply` / `withdraw`, `to` names the
1158
+ * pool with its protocol (e.g. `"vesu_usdc"`). `amount` is in portfolio units
1159
+ * as the model understood them: validate it against your own limits before
1160
+ * acting on it.
1161
+ */
1162
+ interface ThinkDecision {
1163
+ action: ThinkAction;
1164
+ from?: string;
1165
+ to?: string;
1166
+ amount?: number;
1167
+ reason: string;
1168
+ /** 0-1 */
1169
+ confidence?: number;
1170
+ }
1171
+ /**
1172
+ * What the model returned when it was not valid JSON. The call is still billed.
1173
+ * Treat it as `hold`.
1174
+ */
1175
+ interface ThinkRawDecision {
1176
+ raw: string;
1177
+ }
1178
+ /** Risk parameters `/v1/ai/think` applied (your overrides plus the defaults derived from `riskScore`). */
1179
+ interface ThinkRiskParams {
1180
+ /** 1-10 */
1181
+ riskScore: number;
1182
+ maxSingleTradePercent: number;
1183
+ minStablecoinPercent: number;
1184
+ maxDrawdownPercent: number;
1185
+ minSignalStrength: number;
1186
+ minExpectedGainPercent: number;
1187
+ }
1188
+ interface AiUsage {
1189
+ inputTokens: number;
1190
+ outputTokens: number;
1191
+ totalTokens: number;
1192
+ }
1193
+ interface AiCost {
1194
+ /** Amount debited from the organization's credits */
1195
+ charged: number;
1196
+ currency: "USD";
1197
+ }
1198
+ interface ThinkParams extends Partial<Omit<ThinkRiskParams, "riskScore">> {
1199
+ /** Your portfolio, in any JSON shape the model can read (balances, positions, prices). */
1200
+ portfolio: Record<string, unknown>;
1201
+ /** 1-10, clamped by the API. Default 5. */
1202
+ riskScore?: number;
1203
+ /** Model id from `sdk.ai.models()`. Default: the API default. */
1204
+ model?: string;
1205
+ /** Default `"starknet"`. Selects which market signals are injected into the prompt. */
1206
+ chain?: string;
1207
+ history?: {
1208
+ recentDecisions?: number;
1209
+ };
1210
+ }
1211
+ interface ThinkResponse {
1212
+ /** Check with `isThinkDecision` before acting on it. */
1213
+ decision: ThinkDecision | ThinkRawDecision;
1214
+ riskParams: ThinkRiskParams;
1215
+ model: string;
1216
+ provider: string;
1217
+ usage: AiUsage;
1218
+ cost: AiCost;
1219
+ latencyMs: number;
1220
+ /** `true` only for `sk_dev_` keys: canned response, no model was called. */
1221
+ sandbox?: boolean;
1222
+ }
1223
+ interface AiChatMessage {
1224
+ role: "system" | "user" | "assistant";
1225
+ content: string;
1226
+ }
1227
+ interface AiChatParams {
1228
+ messages: AiChatMessage[];
1229
+ model?: string;
1230
+ /** Clamped to the model's accepted range by the API. Default 4096. */
1231
+ max_tokens?: number;
1232
+ }
1233
+ interface AiChatResponse {
1234
+ text: string;
1235
+ model: string;
1236
+ provider: string;
1237
+ usage: AiUsage;
1238
+ cost: AiCost;
1239
+ finishReason: string;
1240
+ latencyMs: number;
1241
+ sandbox?: boolean;
1242
+ }
1243
+ /** Only `swap` on `starknet` today. */
1244
+ interface AiExecuteParams {
1245
+ chain: "starknet";
1246
+ action: "swap";
1247
+ /** Token symbol to sell, e.g. `"USDC"` */
1248
+ from: string;
1249
+ /** Token symbol to buy, e.g. `"ETH"` */
1250
+ to: string;
1251
+ /** Must be > 0 */
1252
+ amountUsd: number;
1253
+ /** The wallet that will sign and send the returned calls */
1254
+ walletAddress: string;
1255
+ /** 0 < slippage < 0.5 (0.005 = 0.5%) */
1256
+ slippage?: number;
1257
+ }
1258
+ interface AiExecuteCall {
1259
+ contractAddress: string;
1260
+ entrypoint: string;
1261
+ calldata: string[];
1262
+ }
1263
+ interface AiSwapQuote {
1264
+ sellToken: string;
1265
+ buyToken: string;
1266
+ /** Raw amount in the sell token's decimals */
1267
+ sellAmount: string;
1268
+ /** Raw amount in the buy token's decimals */
1269
+ buyAmount: string;
1270
+ sellAmountUsd: number;
1271
+ buyAmountUsd: number;
1272
+ /** Percent */
1273
+ priceImpactPct: number;
1274
+ route: string;
1275
+ }
1276
+ /**
1277
+ * Unsigned calls (approve + swap). Nothing is submitted: sign and send them
1278
+ * with a session key or the owner's key.
1279
+ */
1280
+ interface AiExecuteResponse {
1281
+ calls: AiExecuteCall[];
1282
+ quote: AiSwapQuote;
1283
+ cost: AiCost;
1284
+ sandbox?: boolean;
1285
+ }
1286
+ interface AiSignalsParams {
1287
+ /** Symbols, e.g. `["ETH", "STRK"]`. Default: every tracked token. */
1288
+ tokens?: string[];
1289
+ /** Filters `yields` by chain */
1290
+ chain?: string;
1291
+ }
1292
+ interface AiTokenSignals {
1293
+ rsi14: number | null;
1294
+ macd: {
1295
+ value: number;
1296
+ signal: number;
1297
+ histogram: number;
1298
+ } | null;
1299
+ bollingerBands: {
1300
+ upper: number;
1301
+ middle: number;
1302
+ lower: number;
1303
+ } | null;
1304
+ ema: {
1305
+ ema20: number | null;
1306
+ ema50: number | null;
1307
+ ema200: number | null;
1308
+ };
1309
+ trend: "oversold" | "overbought" | "bullish" | "bearish" | "neutral";
1310
+ /** 0-1 */
1311
+ signalStrength: number;
1312
+ }
1313
+ interface AiSignals {
1314
+ tokens: Record<string, AiTokenSignals>;
1315
+ market: {
1316
+ fearGreedIndex: number | null;
1317
+ fearGreedLabel: string | null;
1318
+ };
1319
+ yields: Array<{
1320
+ pool: string;
1321
+ protocol: string;
1322
+ chain: string;
1323
+ apy: number;
1324
+ tvlUsd: number;
1325
+ }>;
1326
+ /** Plain-language definitions of every field */
1327
+ definitions: Record<string, string>;
1328
+ meta: {
1329
+ sources: string[];
1330
+ snapshotsUsed: number;
1331
+ updatedAt: string;
1332
+ };
1333
+ }
1334
+ interface AiPricesParams {
1335
+ /** Symbols, e.g. `["ETH", "STRK"]` (case-insensitive). Default: every tracked token. */
1336
+ tokens?: string[];
1337
+ /** Only tokens listed on this chain, e.g. `"starknet"`. */
1338
+ chain?: string;
1339
+ }
1340
+ interface AiTokenPrice {
1341
+ /** USD */
1342
+ price: number;
1343
+ change1h: number | null;
1344
+ change24h: number | null;
1345
+ change7d: number | null;
1346
+ high24h: number | null;
1347
+ low24h: number | null;
1348
+ marketCap: number | null;
1349
+ marketCapRank: number | null;
1350
+ volume24h: number | null;
1351
+ ath: number | null;
1352
+ athDate: string | null;
1353
+ circulatingSupply: number | null;
1354
+ image: string | null;
1355
+ chains: string[];
1356
+ }
1357
+ interface AiPrices {
1358
+ /** Keyed by symbol as the registry spells it (e.g. `"ETH"`, `"tBTC"`). */
1359
+ tokens: Record<string, AiTokenPrice>;
1360
+ meta: {
1361
+ totalTokens: number;
1362
+ source: string;
1363
+ refreshInterval: number;
1364
+ updatedAt: string;
1365
+ filteredBy?: Record<string, string>;
1366
+ };
1367
+ }
1368
+ interface AiModel {
1369
+ id: string;
1370
+ provider: string;
1371
+ displayName: string;
1372
+ pricing: {
1373
+ inputPer1MTokens: number;
1374
+ outputPer1MTokens: number;
1375
+ currency: "USD";
1376
+ };
1377
+ limits: {
1378
+ maxOutputTokens: number;
1379
+ providerRPM: number;
1380
+ };
1381
+ }
1382
+ interface AiModelsResponse {
1383
+ models: AiModel[];
1384
+ default: string;
1385
+ margin: string;
1386
+ }
1387
+
1134
1388
  /**
1135
1389
  * Plus epic — shared subscription state types.
1136
1390
  *
@@ -1167,4 +1421,4 @@ interface PlanSnapshot {
1167
1421
  planPaymentProvider: PlanPaymentProvider | null;
1168
1422
  }
1169
1423
 
1170
- export { type AddSessionKeyParams, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
1424
+ export { type AddSessionKeyParams, type AiChatMessage, type AiChatParams, type AiChatResponse, type AiCost, type AiExecuteCall, type AiExecuteParams, type AiExecuteResponse, type AiModel, type AiModelsResponse, type AiPrices, type AiPricesParams, type AiSignals, type AiSignalsParams, type AiSwapQuote, type AiTokenPrice, type AiTokenSignals, type AiUsage, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionSpendingPolicy, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type SetupSessionParams, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type ThinkAction, type ThinkDecision, type ThinkParams, type ThinkRawDecision, type ThinkResponse, type ThinkRiskParams, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core.ts","../src/transaction.ts"],"names":["Chain","Currency","ChainToken","OnChainTxStatus"],"mappings":";;;AAqBO,IAAK,KAAA,qBAAAA,MAAAA,KAAL;AACL,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,OAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,OAAA,YAAA,CAAA,GAAa,YAAA;AAPH,EAAA,OAAAA,MAAAA;AAAA,CAAA,EAAA,KAAA,IAAA,EAAA;AAUL,IAAK,QAAA,qBAAAC,SAAAA,KAAL;AACL,EAAAA,UAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,UAAA,KAAA,CAAA,GAAM,KAAA;AAFI,EAAA,OAAAA,SAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA;AAKL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,YAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAA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,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,kBAAiB;AAAA,IAChB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,0BAAqB;AAAA,IACpB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,kBAAiB;AAAA,IAChB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,kBAAiB;AAAA,IAChB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,oBAAkB;AAAA,IACjB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,kBAAiB;AAAA,IAChB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,sBAAmB;AAAA,IAClB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA;AAEd;;;ACyEK,IAAK,eAAA,qBAAAC,gBAAAA,KAAL;AACL,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,iBAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,iBAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,cAAA,CAAA,GAAe,cAAA;AAPL,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA","file":"index.js","sourcesContent":["/**\n * Core configuration and environment types\n */\n\nexport interface ChipiSDKConfig {\n apiPublicKey: string;\n alphaUrl?: string;\n nodeUrl?: string;\n apiSecretKey?: string;\n}\n\nexport interface ChipiServerSDKConfig extends ChipiSDKConfig {\n apiSecretKey: string;\n}\n\nexport interface ChipiBrowserSDKConfig extends Omit<ChipiSDKConfig, \"apiSecretKey\"> {\n apiSecretKey?: never;\n}\n\nexport type alphaUrl = string;\n\nexport enum Chain {\n STARKNET = \"STARKNET\",\n BASE = \"BASE\",\n ARBITRUM = \"ARBITRUM\",\n OPTIMISM = \"OPTIMISM\",\n ROOTSTOCK = \"ROOTSTOCK\",\n SCROLL = \"SCROLL\",\n WORLDCHAIN = \"WORLDCHAIN\",\n}\n\nexport enum Currency {\n MXN = \"MXN\",\n USD = \"USD\",\n}\n\nexport enum ChainToken {\n USDC = \"USDC\",\n USDC_E = \"USDC_E\",\n USDT = \"USDT\",\n DAI = \"DAI\",\n ETH = \"ETH\",\n STRK = \"STRK\",\n SLINK = \"SLINK\",\n ALF = \"ALF\",\n BROTHER = \"BROTHER\",\n ARB = \"ARB\",\n DOC = \"DOC\",\n MXNB = \"MXNB\",\n WLD = \"WLD\",\n WBTC = \"WBTC\",\n OTHER = \"OTHER\",\n}\n\nexport interface PaginationQuery {\n page?: number;\n limit?: number;\n offset?: number;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n total: number;\n page: number;\n limit: number;\n totalPages: number;\n}\n\nexport const STARKNET_CONTRACTS: Record<ChainToken, { contractAddress: string; decimals: number }> =\n {\n [ChainToken.USDC]: {\n contractAddress: \"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb\",\n decimals: 6,\n },\n [ChainToken.USDC_E]: {\n contractAddress: \"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8\",\n decimals: 6,\n },\n [ChainToken.USDT]: {\n contractAddress: \"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8\",\n decimals: 6,\n },\n [ChainToken.DAI]: {\n contractAddress: \"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad\",\n decimals: 18,\n },\n [ChainToken.STRK]: {\n contractAddress: \"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d\",\n decimals: 18,\n },\n [ChainToken.ETH]: {\n contractAddress: \"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n decimals: 18,\n },\n [ChainToken.WBTC]: {\n contractAddress: \"0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac\",\n decimals: 8,\n },\n [ChainToken.SLINK]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ALF]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.BROTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ARB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.DOC]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.MXNB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.WLD]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.OTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n };\n","import type { Call, TypedData } from \"starknet\";\nimport type { WalletData, WalletType } from \"./wallet\";\nimport { Chain, ChainToken, Currency } from \"./core\";\n\n/**\n * Transaction-related types\n */\n\ntype PasskeyEnabledParams = {\n usePasskey: true;\n externalUserId: string;\n /**\n * Scope the passkey prompt to one specific credential. Omit to let the\n * authenticator choose among the credentials registered for this origin.\n *\n * Needed when a user holds more than one Chipi credential on the same\n * device (a wallet that was reset, or a per-entity wallet), where the\n * unscoped prompt can resolve to the wrong one.\n */\n credentialId?: string;\n};\n\ntype PasskeyDisabledParams = {\n usePasskey?: false;\n externalUserId?: string;\n credentialId?: string;\n};\n\ntype PasskeyParams = PasskeyEnabledParams | PasskeyDisabledParams;\n\nexport type ExecuteTransactionParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n calls: Call[];\n};\n\nexport type TxType = string;\nexport type TxStatus = \"PENDING\" | \"PROCESSING\" | \"SUCCESS\" | \"FAILED\" | \"CANCELLED\";\n\nexport interface Transaction {\n id: string;\n type: TxType;\n subType?: string;\n chain: Chain;\n transactionHash: string;\n\n // Parties\n senderAddress: string;\n destinationAddress: string;\n\n // Contract Interaction\n contractAddress?: string;\n contractName?: string;\n functionName?: string;\n functionSelector?: string;\n callData?: unknown;\n\n // Token Transfer (nullable for non-token operations)\n token?: ChainToken;\n tokenAddress?: string;\n amount?: string;\n\n // NFT Specific\n nftTokenId?: string;\n nftContract?: string;\n nftMetadata?: Record<string, unknown>;\n\n // SKU Specific\n skuId?: string;\n skuReference?: string;\n skuPurchaseAmount?: number;\n skuPurchaseCurrency?: Currency;\n skuFileNumber?: string;\n\n // Status\n status: TxStatus;\n\n // Timestamps\n createdAt: Date;\n confirmedAt?: Date;\n updatedAt: Date;\n\n // Relations\n apiPublicKey: string;\n chipiWalletId?: string;\n destinationChipiWalletId?: string;\n}\n\nexport interface PrepareTypedDataParams {\n calls: Call[];\n walletAddress: string;\n}\n\nexport interface PrepareTypedDataResponse {\n typedData: TypedData;\n walletType: WalletType;\n}\n\nexport interface ExecuteSponsoredTransactionParams {\n calls: Call[];\n walletAddress: string;\n signature: string[];\n apiPublicKey: string;\n}\n\nexport interface ExecuteSponsoredTransactionResponse {\n transactionHash: string;\n}\n\nexport interface RecordSendTransactionParams {\n transactionHash: string;\n expectedSender: string;\n expectedRecipient: string;\n expectedToken: ChainToken;\n expectedAmount: string;\n chain: Chain;\n}\n\n// Specific transaction types\nexport type TransferParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: string;\n};\n\nexport type TransferHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: number;\n};\n\nexport type ApproveParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n amount: string;\n decimals?: number;\n};\n\nexport type ApproveHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n decimals?: number;\n amount: number;\n};\n\nexport type CallAnyContractParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n calls: Call[];\n};\n\nexport interface GetTransactionsParams {\n page?: number;\n limit?: number;\n orgId: string;\n}\n\nexport interface GetTransactionListQuery {\n page?: number;\n limit?: number;\n calledFunction?: string;\n walletAddress: string; // Required: wallet address to filter transactions\n day?: number; // Day of the month (1-31)\n month?: number; // Month of the year (1-12)\n year?: number; // Year (e.g., 2025)\n}\n\n/**\n * Parameters for fetching a single transaction by hash or internal ID.\n */\nexport interface GetTransactionParams {\n /** Transaction hash (0x...) or internal database ID */\n hashOrId: string;\n}\n\n/**\n * Parameters for fetching on-chain transaction status.\n */\nexport interface GetTransactionStatusParams {\n /** Transaction hash (0x...) */\n hash: string;\n}\n\n/**\n * On-chain transaction status from StarkNet sequencer.\n */\nexport enum OnChainTxStatus {\n RECEIVED = \"RECEIVED\",\n PENDING = \"PENDING\",\n ACCEPTED_ON_L2 = \"ACCEPTED_ON_L2\",\n ACCEPTED_ON_L1 = \"ACCEPTED_ON_L1\",\n REJECTED = \"REJECTED\",\n REVERTED = \"REVERTED\",\n NOT_RECEIVED = \"NOT_RECEIVED\",\n}\n\n/**\n * Response from the transaction status endpoint.\n */\nexport interface TransactionStatusResponse {\n /** Transaction hash */\n transactionHash: string;\n /** Current on-chain status */\n status: OnChainTxStatus;\n /** Block number (if included in a block) */\n blockNumber?: number;\n /** Revert reason (if status is REVERTED) */\n revertReason?: string;\n}\n\n/**\n * Minimal account interface for PaymasterAdapter.\n * Compatible with starknet.js Account, external wallet objects, and Cartridge Controller.\n */\nexport interface PaymasterAccount {\n address: string;\n signMessage(typedData: TypedData): Promise<unknown>;\n getClassHashAt(contractAddress: string): Promise<string>;\n}\n\n/**\n * Adapter for executing gasless (paymaster-sponsored) transactions.\n *\n * Handles the full flow: prepare typed data -> sign -> submit to paymaster.\n * For external wallets (Argent X, Braavos), `account.signMessage()` triggers the wallet popup.\n * For DirectSigner, signing happens programmatically.\n */\nexport interface PaymasterAdapter {\n execute(params: { account: PaymasterAccount; calls: Call[] }): Promise<string>;\n}\n\n/**\n * Parameters for signing SNIP-12 typed data without executing a transaction.\n * Useful for x402 payment signatures and other off-chain signing flows.\n */\nexport interface SignTypedDataParams {\n /** Encryption key (PIN) to decrypt the private key */\n encryptKey: string;\n /** Wallet data containing encrypted private key */\n wallet: WalletData;\n /** SNIP-12 typed data to sign */\n typedData: TypedData;\n}\n\n/**\n * Result of signing SNIP-12 typed data.\n */\nexport interface SignTypedDataResult {\n /** Signature r component */\n r: string;\n /** Signature s component */\n s: string;\n}\n\n/**\n * Parameters for syncing on-chain transactions from Voyager.\n */\nexport interface SyncOnChainTransfersParams {\n /** Wallet address to sync transfers for */\n walletAddress: string;\n}\n\n/**\n * Response from sync-on-chain endpoint.\n */\nexport interface SyncOnChainTransfersResponse {\n /** Number of new transactions synced to DB */\n synced: number;\n /** Total transfers found on-chain */\n total: number;\n}\n"]}
1
+ {"version":3,"sources":["../src/core.ts","../src/transaction.ts"],"names":["Chain","Currency","ChainToken","OnChainTxStatus"],"mappings":";;;AAqBO,IAAK,KAAA,qBAAAA,MAAAA,KAAL;AACL,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,OAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,OAAA,YAAA,CAAA,GAAa,YAAA;AAPH,EAAA,OAAAA,MAAAA;AAAA,CAAA,EAAA,KAAA,IAAA,EAAA;AAUL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U,SAAA;AACV,EAAAA,iBAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,iBAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,cAAA,CAAA,GAAe,cAAA;AAPL,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA","file":"index.js","sourcesContent":["/**\n * Core configuration and environment types\n */\n\nexport interface ChipiSDKConfig {\n apiPublicKey: string;\n alphaUrl?: string;\n nodeUrl?: string;\n apiSecretKey?: string;\n}\n\nexport interface ChipiServerSDKConfig extends ChipiSDKConfig {\n apiSecretKey: string;\n}\n\nexport interface ChipiBrowserSDKConfig extends Omit<ChipiSDKConfig, \"apiSecretKey\"> {\n apiSecretKey?: never;\n}\n\nexport type alphaUrl = string;\n\nexport enum Chain {\n STARKNET = \"STARKNET\",\n BASE = \"BASE\",\n ARBITRUM = \"ARBITRUM\",\n OPTIMISM = \"OPTIMISM\",\n ROOTSTOCK = \"ROOTSTOCK\",\n SCROLL = \"SCROLL\",\n WORLDCHAIN = \"WORLDCHAIN\",\n}\n\nexport enum Currency {\n MXN = \"MXN\",\n USD = \"USD\",\n}\n\nexport enum ChainToken {\n USDC = \"USDC\",\n USDC_E = \"USDC_E\",\n USDT = \"USDT\",\n DAI = \"DAI\",\n ETH = \"ETH\",\n STRK = \"STRK\",\n SLINK = \"SLINK\",\n ALF = \"ALF\",\n BROTHER = \"BROTHER\",\n ARB = \"ARB\",\n DOC = \"DOC\",\n MXNB = \"MXNB\",\n WLD = \"WLD\",\n WBTC = \"WBTC\",\n OTHER = \"OTHER\",\n}\n\nexport interface PaginationQuery {\n page?: number;\n limit?: number;\n offset?: number;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n total: number;\n page: number;\n limit: number;\n totalPages: number;\n}\n\nexport const STARKNET_CONTRACTS: Record<ChainToken, { contractAddress: string; decimals: number }> =\n {\n [ChainToken.USDC]: {\n contractAddress: \"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb\",\n decimals: 6,\n },\n [ChainToken.USDC_E]: {\n contractAddress: \"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8\",\n decimals: 6,\n },\n [ChainToken.USDT]: {\n contractAddress: \"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8\",\n decimals: 6,\n },\n [ChainToken.DAI]: {\n contractAddress: \"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad\",\n decimals: 18,\n },\n [ChainToken.STRK]: {\n contractAddress: \"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d\",\n decimals: 18,\n },\n [ChainToken.ETH]: {\n contractAddress: \"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n decimals: 18,\n },\n [ChainToken.WBTC]: {\n contractAddress: \"0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac\",\n decimals: 8,\n },\n [ChainToken.SLINK]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ALF]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.BROTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ARB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.DOC]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.MXNB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.WLD]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.OTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n };\n","import type { Call, TypedData } from \"starknet\";\nimport type { WalletData, WalletType } from \"./wallet\";\nimport { Chain, ChainToken, Currency } from \"./core\";\n\n/**\n * Transaction-related types\n */\n\ntype PasskeyEnabledParams = {\n usePasskey: true;\n externalUserId: string;\n /**\n * Scope the passkey prompt to one specific credential. Omit to let the\n * authenticator choose among the credentials registered for this origin.\n *\n * Needed when a user holds more than one Chipi credential on the same\n * device (a wallet that was reset, or a per-entity wallet), where the\n * unscoped prompt can resolve to the wrong one.\n */\n credentialId?: string;\n};\n\ntype PasskeyDisabledParams = {\n usePasskey?: false;\n externalUserId?: string;\n credentialId?: string;\n};\n\ntype PasskeyParams = PasskeyEnabledParams | PasskeyDisabledParams;\n\nexport type ExecuteTransactionParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n calls: Call[];\n};\n\nexport type TxType = string;\nexport type TxStatus = \"PENDING\" | \"PROCESSING\" | \"SUCCESS\" | \"FAILED\" | \"CANCELLED\";\n\nexport interface Transaction {\n id: string;\n type: TxType;\n subType?: string;\n chain: Chain;\n transactionHash: string;\n\n // Parties\n senderAddress: string;\n destinationAddress: string;\n\n // Contract Interaction\n contractAddress?: string;\n contractName?: string;\n functionName?: string;\n functionSelector?: string;\n callData?: unknown;\n\n // Token Transfer (nullable for non-token operations)\n token?: ChainToken;\n tokenAddress?: string;\n amount?: string;\n\n // NFT Specific\n nftTokenId?: string;\n nftContract?: string;\n nftMetadata?: Record<string, unknown>;\n\n // SKU Specific\n skuId?: string;\n skuReference?: string;\n skuPurchaseAmount?: number;\n skuPurchaseCurrency?: Currency;\n skuFileNumber?: string;\n\n // Status\n status: TxStatus;\n\n // Timestamps\n createdAt: Date;\n confirmedAt?: Date;\n updatedAt: Date;\n\n // Relations\n apiPublicKey: string;\n chipiWalletId?: string;\n destinationChipiWalletId?: string;\n}\n\nexport interface PrepareTypedDataParams {\n calls: Call[];\n walletAddress: string;\n}\n\nexport interface PrepareTypedDataResponse {\n typedData: TypedData;\n walletType: WalletType;\n}\n\nexport interface ExecuteSponsoredTransactionParams {\n calls: Call[];\n walletAddress: string;\n signature: string[];\n apiPublicKey: string;\n}\n\nexport interface ExecuteSponsoredTransactionResponse {\n transactionHash: string;\n}\n\nexport interface RecordSendTransactionParams {\n transactionHash: string;\n expectedSender: string;\n expectedRecipient: string;\n expectedToken: ChainToken;\n expectedAmount: string;\n chain: Chain;\n}\n\n// Specific transaction types\nexport type TransferParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: string;\n};\n\nexport type TransferHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: number;\n};\n\nexport type ApproveParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n amount: string;\n decimals?: number;\n};\n\nexport type ApproveHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n decimals?: number;\n amount: number;\n};\n\nexport type CallAnyContractParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n calls: Call[];\n};\n\nexport interface GetTransactionsParams {\n page?: number;\n limit?: number;\n orgId: string;\n}\n\nexport interface GetTransactionListQuery {\n page?: number;\n limit?: number;\n calledFunction?: string;\n walletAddress: string; // Required: wallet address to filter transactions\n day?: number; // Day of the month (1-31)\n month?: number; // Month of the year (1-12)\n year?: number; // Year (e.g., 2025)\n}\n\n/**\n * Parameters for fetching a single transaction by hash or internal ID.\n */\nexport interface GetTransactionParams {\n /** Transaction hash (0x...) or internal database ID */\n hashOrId: string;\n}\n\n/**\n * Parameters for fetching on-chain transaction status.\n */\nexport interface GetTransactionStatusParams {\n /** Transaction hash (0x...) */\n hash: string;\n}\n\n/**\n * On-chain transaction status from StarkNet sequencer.\n */\nexport enum OnChainTxStatus {\n RECEIVED = \"RECEIVED\",\n PENDING = \"PENDING\",\n ACCEPTED_ON_L2 = \"ACCEPTED_ON_L2\",\n ACCEPTED_ON_L1 = \"ACCEPTED_ON_L1\",\n REJECTED = \"REJECTED\",\n REVERTED = \"REVERTED\",\n NOT_RECEIVED = \"NOT_RECEIVED\",\n}\n\n/**\n * Response from the transaction status endpoint.\n */\nexport interface TransactionStatusResponse {\n /** Transaction hash */\n transactionHash: string;\n /** Current on-chain status */\n status: OnChainTxStatus;\n /** Block number (if included in a block) */\n blockNumber?: number;\n /** Revert reason (if status is REVERTED) */\n revertReason?: string;\n}\n\n/**\n * Minimal account interface for PaymasterAdapter.\n * Compatible with starknet.js Account, external wallet objects, and Cartridge Controller.\n */\nexport interface PaymasterAccount {\n address: string;\n signMessage(typedData: TypedData): Promise<unknown>;\n getClassHashAt(contractAddress: string): Promise<string>;\n}\n\n/**\n * Adapter for executing gasless (paymaster-sponsored) transactions.\n *\n * Handles the full flow: prepare typed data -> sign -> submit to paymaster.\n * For external wallets (Argent X, Braavos), `account.signMessage()` triggers the wallet popup.\n * For DirectSigner, signing happens programmatically.\n */\nexport interface PaymasterAdapter {\n execute(params: { account: PaymasterAccount; calls: Call[] }): Promise<string>;\n}\n\n/**\n * Parameters for signing SNIP-12 typed data without executing a transaction.\n * Useful for x402 payment signatures and other off-chain signing flows.\n */\nexport interface SignTypedDataParams {\n /** Encryption key (PIN) to decrypt the private key */\n encryptKey: string;\n /** Wallet data containing encrypted private key */\n wallet: WalletData;\n /** SNIP-12 typed data to sign */\n typedData: TypedData;\n}\n\n/**\n * Result of signing SNIP-12 typed data.\n */\nexport interface SignTypedDataResult {\n /** Signature r component */\n r: string;\n /** Signature s component */\n s: string;\n}\n\n/**\n * Parameters for syncing a wallet's on-chain transfers (read from Starknet events by the backend).\n */\nexport interface SyncOnChainTransfersParams {\n /** Wallet address to sync transfers for */\n walletAddress: string;\n}\n\n/**\n * Response from sync-on-chain endpoint.\n */\nexport interface SyncOnChainTransfersResponse {\n /** Number of new transactions synced to DB */\n synced: number;\n /** Total transfers found on-chain */\n total: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src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AAA,IAChB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,oBAAkB;AAAA,IACjB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,kBAAiB;AAAA,IAChB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,CAAC,sBAAmB;AAAA,IAClB,eAAA,EAAiB,EAAA;AAAA,IACjB,QAAA,EAAU;AAAA;AAEd;;;ACyEK,IAAK,eAAA,qBAAAC,gBAAAA,KAAL;AACL,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,iBAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,iBAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,iBAAA,cAAA,CAAA,GAAe,cAAA;AAPL,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA","file":"index.mjs","sourcesContent":["/**\n * Core configuration and environment types\n */\n\nexport interface ChipiSDKConfig {\n apiPublicKey: string;\n alphaUrl?: string;\n nodeUrl?: string;\n apiSecretKey?: string;\n}\n\nexport interface ChipiServerSDKConfig extends ChipiSDKConfig {\n apiSecretKey: string;\n}\n\nexport interface ChipiBrowserSDKConfig extends Omit<ChipiSDKConfig, \"apiSecretKey\"> {\n apiSecretKey?: never;\n}\n\nexport type alphaUrl = string;\n\nexport enum Chain {\n STARKNET = \"STARKNET\",\n BASE = \"BASE\",\n ARBITRUM = \"ARBITRUM\",\n OPTIMISM = \"OPTIMISM\",\n ROOTSTOCK = \"ROOTSTOCK\",\n SCROLL = \"SCROLL\",\n WORLDCHAIN = \"WORLDCHAIN\",\n}\n\nexport enum Currency {\n MXN = \"MXN\",\n USD = \"USD\",\n}\n\nexport enum ChainToken {\n USDC = \"USDC\",\n USDC_E = \"USDC_E\",\n USDT = \"USDT\",\n DAI = \"DAI\",\n ETH = \"ETH\",\n STRK = \"STRK\",\n SLINK = \"SLINK\",\n ALF = \"ALF\",\n BROTHER = \"BROTHER\",\n ARB = \"ARB\",\n DOC = \"DOC\",\n MXNB = \"MXNB\",\n WLD = \"WLD\",\n WBTC = \"WBTC\",\n OTHER = \"OTHER\",\n}\n\nexport interface PaginationQuery {\n page?: number;\n limit?: number;\n offset?: number;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n total: number;\n page: number;\n limit: number;\n totalPages: number;\n}\n\nexport const STARKNET_CONTRACTS: Record<ChainToken, { contractAddress: string; decimals: number }> =\n {\n [ChainToken.USDC]: {\n contractAddress: \"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb\",\n decimals: 6,\n },\n [ChainToken.USDC_E]: {\n contractAddress: \"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8\",\n decimals: 6,\n },\n [ChainToken.USDT]: {\n contractAddress: \"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8\",\n decimals: 6,\n },\n [ChainToken.DAI]: {\n contractAddress: \"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad\",\n decimals: 18,\n },\n [ChainToken.STRK]: {\n contractAddress: \"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d\",\n decimals: 18,\n },\n [ChainToken.ETH]: {\n contractAddress: \"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n decimals: 18,\n },\n [ChainToken.WBTC]: {\n contractAddress: \"0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac\",\n decimals: 8,\n },\n [ChainToken.SLINK]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ALF]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.BROTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ARB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.DOC]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.MXNB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.WLD]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.OTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n };\n","import type { Call, TypedData } from \"starknet\";\nimport type { WalletData, WalletType } from \"./wallet\";\nimport { Chain, ChainToken, Currency } from \"./core\";\n\n/**\n * Transaction-related types\n */\n\ntype PasskeyEnabledParams = {\n usePasskey: true;\n externalUserId: string;\n /**\n * Scope the passkey prompt to one specific credential. Omit to let the\n * authenticator choose among the credentials registered for this origin.\n *\n * Needed when a user holds more than one Chipi credential on the same\n * device (a wallet that was reset, or a per-entity wallet), where the\n * unscoped prompt can resolve to the wrong one.\n */\n credentialId?: string;\n};\n\ntype PasskeyDisabledParams = {\n usePasskey?: false;\n externalUserId?: string;\n credentialId?: string;\n};\n\ntype PasskeyParams = PasskeyEnabledParams | PasskeyDisabledParams;\n\nexport type ExecuteTransactionParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n calls: Call[];\n};\n\nexport type TxType = string;\nexport type TxStatus = \"PENDING\" | \"PROCESSING\" | \"SUCCESS\" | \"FAILED\" | \"CANCELLED\";\n\nexport interface Transaction {\n id: string;\n type: TxType;\n subType?: string;\n chain: Chain;\n transactionHash: string;\n\n // Parties\n senderAddress: string;\n destinationAddress: string;\n\n // Contract Interaction\n contractAddress?: string;\n contractName?: string;\n functionName?: string;\n functionSelector?: string;\n callData?: unknown;\n\n // Token Transfer (nullable for non-token operations)\n token?: ChainToken;\n tokenAddress?: string;\n amount?: string;\n\n // NFT Specific\n nftTokenId?: string;\n nftContract?: string;\n nftMetadata?: Record<string, unknown>;\n\n // SKU Specific\n skuId?: string;\n skuReference?: string;\n skuPurchaseAmount?: number;\n skuPurchaseCurrency?: Currency;\n skuFileNumber?: string;\n\n // Status\n status: TxStatus;\n\n // Timestamps\n createdAt: Date;\n confirmedAt?: Date;\n updatedAt: Date;\n\n // Relations\n apiPublicKey: string;\n chipiWalletId?: string;\n destinationChipiWalletId?: string;\n}\n\nexport interface PrepareTypedDataParams {\n calls: Call[];\n walletAddress: string;\n}\n\nexport interface PrepareTypedDataResponse {\n typedData: TypedData;\n walletType: WalletType;\n}\n\nexport interface ExecuteSponsoredTransactionParams {\n calls: Call[];\n walletAddress: string;\n signature: string[];\n apiPublicKey: string;\n}\n\nexport interface ExecuteSponsoredTransactionResponse {\n transactionHash: string;\n}\n\nexport interface RecordSendTransactionParams {\n transactionHash: string;\n expectedSender: string;\n expectedRecipient: string;\n expectedToken: ChainToken;\n expectedAmount: string;\n chain: Chain;\n}\n\n// Specific transaction types\nexport type TransferParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: string;\n};\n\nexport type TransferHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: number;\n};\n\nexport type ApproveParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n amount: string;\n decimals?: number;\n};\n\nexport type ApproveHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n decimals?: number;\n amount: number;\n};\n\nexport type CallAnyContractParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n calls: Call[];\n};\n\nexport interface GetTransactionsParams {\n page?: number;\n limit?: number;\n orgId: string;\n}\n\nexport interface GetTransactionListQuery {\n page?: number;\n limit?: number;\n calledFunction?: string;\n walletAddress: string; // Required: wallet address to filter transactions\n day?: number; // Day of the month (1-31)\n month?: number; // Month of the year (1-12)\n year?: number; // Year (e.g., 2025)\n}\n\n/**\n * Parameters for fetching a single transaction by hash or internal ID.\n */\nexport interface GetTransactionParams {\n /** Transaction hash (0x...) or internal database ID */\n hashOrId: string;\n}\n\n/**\n * Parameters for fetching on-chain transaction status.\n */\nexport interface GetTransactionStatusParams {\n /** Transaction hash (0x...) */\n hash: string;\n}\n\n/**\n * On-chain transaction status from StarkNet sequencer.\n */\nexport enum OnChainTxStatus {\n RECEIVED = \"RECEIVED\",\n PENDING = \"PENDING\",\n ACCEPTED_ON_L2 = \"ACCEPTED_ON_L2\",\n ACCEPTED_ON_L1 = \"ACCEPTED_ON_L1\",\n REJECTED = \"REJECTED\",\n REVERTED = \"REVERTED\",\n NOT_RECEIVED = \"NOT_RECEIVED\",\n}\n\n/**\n * Response from the transaction status endpoint.\n */\nexport interface TransactionStatusResponse {\n /** Transaction hash */\n transactionHash: string;\n /** Current on-chain status */\n status: OnChainTxStatus;\n /** Block number (if included in a block) */\n blockNumber?: number;\n /** Revert reason (if status is REVERTED) */\n revertReason?: string;\n}\n\n/**\n * Minimal account interface for PaymasterAdapter.\n * Compatible with starknet.js Account, external wallet objects, and Cartridge Controller.\n */\nexport interface PaymasterAccount {\n address: string;\n signMessage(typedData: TypedData): Promise<unknown>;\n getClassHashAt(contractAddress: string): Promise<string>;\n}\n\n/**\n * Adapter for executing gasless (paymaster-sponsored) transactions.\n *\n * Handles the full flow: prepare typed data -> sign -> submit to paymaster.\n * For external wallets (Argent X, Braavos), `account.signMessage()` triggers the wallet popup.\n * For DirectSigner, signing happens programmatically.\n */\nexport interface PaymasterAdapter {\n execute(params: { account: PaymasterAccount; calls: Call[] }): Promise<string>;\n}\n\n/**\n * Parameters for signing SNIP-12 typed data without executing a transaction.\n * Useful for x402 payment signatures and other off-chain signing flows.\n */\nexport interface SignTypedDataParams {\n /** Encryption key (PIN) to decrypt the private key */\n encryptKey: string;\n /** Wallet data containing encrypted private key */\n wallet: WalletData;\n /** SNIP-12 typed data to sign */\n typedData: TypedData;\n}\n\n/**\n * Result of signing SNIP-12 typed data.\n */\nexport interface SignTypedDataResult {\n /** Signature r component */\n r: string;\n /** Signature s component */\n s: string;\n}\n\n/**\n * Parameters for syncing on-chain transactions from Voyager.\n */\nexport interface SyncOnChainTransfersParams {\n /** Wallet address to sync transfers for */\n walletAddress: string;\n}\n\n/**\n * Response from sync-on-chain endpoint.\n */\nexport interface SyncOnChainTransfersResponse {\n /** Number of new transactions synced to DB */\n synced: number;\n /** Total transfers found on-chain */\n total: number;\n}\n"]}
1
+ {"version":3,"sources":["../src/core.ts","../src/transaction.ts"],"names":["Chain","Currency","ChainToken","OnChainTxStatus"],"mappings":";AAqBO,IAAK,KAAA,qBAAAA,MAAAA,KAAL;AACL,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,OAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,OAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,OAAA,YAAA,CAAA,GAAa,YAAA;AAPH,EAAA,OAAAA,MAAAA;AAAA,CAAA,EAAA,KAAA,IAAA,EAAA;AAUL,IAAK,QAAA,qBAAAC,SAAAA,KAAL;AACL,EAAAA,UAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,UAAA,KAAA,CAAA,GAAM,KAAA;AAFI,EAAA,OAAAA,SAAAA;AAAA,CAAA,EAAA,QAAA,IAAA,EAAA;AAKL,IAAK,UAAA,qBAAAC,WAAAA,KAAL;AACL,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,YAAA,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* Core configuration and environment types\n */\n\nexport interface ChipiSDKConfig {\n apiPublicKey: string;\n alphaUrl?: string;\n nodeUrl?: string;\n apiSecretKey?: string;\n}\n\nexport interface ChipiServerSDKConfig extends ChipiSDKConfig {\n apiSecretKey: string;\n}\n\nexport interface ChipiBrowserSDKConfig extends Omit<ChipiSDKConfig, \"apiSecretKey\"> {\n apiSecretKey?: never;\n}\n\nexport type alphaUrl = string;\n\nexport enum Chain {\n STARKNET = \"STARKNET\",\n BASE = \"BASE\",\n ARBITRUM = \"ARBITRUM\",\n OPTIMISM = \"OPTIMISM\",\n ROOTSTOCK = \"ROOTSTOCK\",\n SCROLL = \"SCROLL\",\n WORLDCHAIN = \"WORLDCHAIN\",\n}\n\nexport enum Currency {\n MXN = \"MXN\",\n USD = \"USD\",\n}\n\nexport enum ChainToken {\n USDC = \"USDC\",\n USDC_E = \"USDC_E\",\n USDT = \"USDT\",\n DAI = \"DAI\",\n ETH = \"ETH\",\n STRK = \"STRK\",\n SLINK = \"SLINK\",\n ALF = \"ALF\",\n BROTHER = \"BROTHER\",\n ARB = \"ARB\",\n DOC = \"DOC\",\n MXNB = \"MXNB\",\n WLD = \"WLD\",\n WBTC = \"WBTC\",\n OTHER = \"OTHER\",\n}\n\nexport interface PaginationQuery {\n page?: number;\n limit?: number;\n offset?: number;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n total: number;\n page: number;\n limit: number;\n totalPages: number;\n}\n\nexport const STARKNET_CONTRACTS: Record<ChainToken, { contractAddress: string; decimals: number }> =\n {\n [ChainToken.USDC]: {\n contractAddress: \"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb\",\n decimals: 6,\n },\n [ChainToken.USDC_E]: {\n contractAddress: \"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8\",\n decimals: 6,\n },\n [ChainToken.USDT]: {\n contractAddress: \"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8\",\n decimals: 6,\n },\n [ChainToken.DAI]: {\n contractAddress: \"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad\",\n decimals: 18,\n },\n [ChainToken.STRK]: {\n contractAddress: \"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d\",\n decimals: 18,\n },\n [ChainToken.ETH]: {\n contractAddress: \"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n decimals: 18,\n },\n [ChainToken.WBTC]: {\n contractAddress: \"0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac\",\n decimals: 8,\n },\n [ChainToken.SLINK]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ALF]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.BROTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.ARB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.DOC]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.MXNB]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.WLD]: {\n contractAddress: \"\",\n decimals: 18,\n },\n [ChainToken.OTHER]: {\n contractAddress: \"\",\n decimals: 18,\n },\n };\n","import type { Call, TypedData } from \"starknet\";\nimport type { WalletData, WalletType } from \"./wallet\";\nimport { Chain, ChainToken, Currency } from \"./core\";\n\n/**\n * Transaction-related types\n */\n\ntype PasskeyEnabledParams = {\n usePasskey: true;\n externalUserId: string;\n /**\n * Scope the passkey prompt to one specific credential. Omit to let the\n * authenticator choose among the credentials registered for this origin.\n *\n * Needed when a user holds more than one Chipi credential on the same\n * device (a wallet that was reset, or a per-entity wallet), where the\n * unscoped prompt can resolve to the wrong one.\n */\n credentialId?: string;\n};\n\ntype PasskeyDisabledParams = {\n usePasskey?: false;\n externalUserId?: string;\n credentialId?: string;\n};\n\ntype PasskeyParams = PasskeyEnabledParams | PasskeyDisabledParams;\n\nexport type ExecuteTransactionParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n calls: Call[];\n};\n\nexport type TxType = string;\nexport type TxStatus = \"PENDING\" | \"PROCESSING\" | \"SUCCESS\" | \"FAILED\" | \"CANCELLED\";\n\nexport interface Transaction {\n id: string;\n type: TxType;\n subType?: string;\n chain: Chain;\n transactionHash: string;\n\n // Parties\n senderAddress: string;\n destinationAddress: string;\n\n // Contract Interaction\n contractAddress?: string;\n contractName?: string;\n functionName?: string;\n functionSelector?: string;\n callData?: unknown;\n\n // Token Transfer (nullable for non-token operations)\n token?: ChainToken;\n tokenAddress?: string;\n amount?: string;\n\n // NFT Specific\n nftTokenId?: string;\n nftContract?: string;\n nftMetadata?: Record<string, unknown>;\n\n // SKU Specific\n skuId?: string;\n skuReference?: string;\n skuPurchaseAmount?: number;\n skuPurchaseCurrency?: Currency;\n skuFileNumber?: string;\n\n // Status\n status: TxStatus;\n\n // Timestamps\n createdAt: Date;\n confirmedAt?: Date;\n updatedAt: Date;\n\n // Relations\n apiPublicKey: string;\n chipiWalletId?: string;\n destinationChipiWalletId?: string;\n}\n\nexport interface PrepareTypedDataParams {\n calls: Call[];\n walletAddress: string;\n}\n\nexport interface PrepareTypedDataResponse {\n typedData: TypedData;\n walletType: WalletType;\n}\n\nexport interface ExecuteSponsoredTransactionParams {\n calls: Call[];\n walletAddress: string;\n signature: string[];\n apiPublicKey: string;\n}\n\nexport interface ExecuteSponsoredTransactionResponse {\n transactionHash: string;\n}\n\nexport interface RecordSendTransactionParams {\n transactionHash: string;\n expectedSender: string;\n expectedRecipient: string;\n expectedToken: ChainToken;\n expectedAmount: string;\n chain: Chain;\n}\n\n// Specific transaction types\nexport type TransferParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: string;\n};\n\nexport type TransferHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n token: ChainToken;\n otherToken?: {\n contractAddress: string;\n decimals: number;\n };\n recipient: string;\n amount: number;\n};\n\nexport type ApproveParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n amount: string;\n decimals?: number;\n};\n\nexport type ApproveHookInput = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n spender: string;\n decimals?: number;\n amount: number;\n};\n\nexport type CallAnyContractParams = PasskeyParams & {\n encryptKey?: string;\n wallet: WalletData;\n contractAddress: string;\n calls: Call[];\n};\n\nexport interface GetTransactionsParams {\n page?: number;\n limit?: number;\n orgId: string;\n}\n\nexport interface GetTransactionListQuery {\n page?: number;\n limit?: number;\n calledFunction?: string;\n walletAddress: string; // Required: wallet address to filter transactions\n day?: number; // Day of the month (1-31)\n month?: number; // Month of the year (1-12)\n year?: number; // Year (e.g., 2025)\n}\n\n/**\n * Parameters for fetching a single transaction by hash or internal ID.\n */\nexport interface GetTransactionParams {\n /** Transaction hash (0x...) or internal database ID */\n hashOrId: string;\n}\n\n/**\n * Parameters for fetching on-chain transaction status.\n */\nexport interface GetTransactionStatusParams {\n /** Transaction hash (0x...) */\n hash: string;\n}\n\n/**\n * On-chain transaction status from StarkNet sequencer.\n */\nexport enum OnChainTxStatus {\n RECEIVED = \"RECEIVED\",\n PENDING = \"PENDING\",\n ACCEPTED_ON_L2 = \"ACCEPTED_ON_L2\",\n ACCEPTED_ON_L1 = \"ACCEPTED_ON_L1\",\n REJECTED = \"REJECTED\",\n REVERTED = \"REVERTED\",\n NOT_RECEIVED = \"NOT_RECEIVED\",\n}\n\n/**\n * Response from the transaction status endpoint.\n */\nexport interface TransactionStatusResponse {\n /** Transaction hash */\n transactionHash: string;\n /** Current on-chain status */\n status: OnChainTxStatus;\n /** Block number (if included in a block) */\n blockNumber?: number;\n /** Revert reason (if status is REVERTED) */\n revertReason?: string;\n}\n\n/**\n * Minimal account interface for PaymasterAdapter.\n * Compatible with starknet.js Account, external wallet objects, and Cartridge Controller.\n */\nexport interface PaymasterAccount {\n address: string;\n signMessage(typedData: TypedData): Promise<unknown>;\n getClassHashAt(contractAddress: string): Promise<string>;\n}\n\n/**\n * Adapter for executing gasless (paymaster-sponsored) transactions.\n *\n * Handles the full flow: prepare typed data -> sign -> submit to paymaster.\n * For external wallets (Argent X, Braavos), `account.signMessage()` triggers the wallet popup.\n * For DirectSigner, signing happens programmatically.\n */\nexport interface PaymasterAdapter {\n execute(params: { account: PaymasterAccount; calls: Call[] }): Promise<string>;\n}\n\n/**\n * Parameters for signing SNIP-12 typed data without executing a transaction.\n * Useful for x402 payment signatures and other off-chain signing flows.\n */\nexport interface SignTypedDataParams {\n /** Encryption key (PIN) to decrypt the private key */\n encryptKey: string;\n /** Wallet data containing encrypted private key */\n wallet: WalletData;\n /** SNIP-12 typed data to sign */\n typedData: TypedData;\n}\n\n/**\n * Result of signing SNIP-12 typed data.\n */\nexport interface SignTypedDataResult {\n /** Signature r component */\n r: string;\n /** Signature s component */\n s: string;\n}\n\n/**\n * Parameters for syncing a wallet's on-chain transfers (read from Starknet events by the backend).\n */\nexport interface SyncOnChainTransfersParams {\n /** Wallet address to sync transfers for */\n walletAddress: string;\n}\n\n/**\n * Response from sync-on-chain endpoint.\n */\nexport interface SyncOnChainTransfersResponse {\n /** Number of new transactions synced to DB */\n synced: number;\n /** Total transfers found on-chain */\n total: number;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipi-stack/types",
3
- "version": "14.13.1",
3
+ "version": "14.14.0",
4
4
  "description": "Type definitions for Chipi SDK packages",
5
5
  "keywords": [
6
6
  "chipi",