@capxul/sdk 0.1.0-alpha.3 → 0.1.0-alpha.4
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/CHANGELOG.md +23 -0
- package/dist/{client-CwcnMbGv.d.cts → client-CXRKtbfn.d.cts} +201 -74
- package/dist/{client-BI863O0y.d.ts → client-CcCtq5XO.d.ts} +201 -74
- package/dist/client.cjs +476 -14
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +476 -14
- package/dist/index.cjs +477 -14
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +477 -15
- package/dist/{types-BE3tVIOI.d.ts → types-75UokagF.d.ts} +9 -1
- package/dist/{types-z4VLz9rS.d.cts → types-DVWojoy4.d.cts} +9 -1
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -73,9 +73,79 @@ function fromConvexError(error) {
|
|
|
73
73
|
// src/core/accounts.ts
|
|
74
74
|
function createAccountsClient(config = {}) {
|
|
75
75
|
return {
|
|
76
|
-
retrieve: async () =>
|
|
76
|
+
retrieve: async (accountId) => {
|
|
77
|
+
if (!config.data) {
|
|
78
|
+
return stub("accounts.retrieve");
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const account = await config.data.query(
|
|
82
|
+
api.openfort.queries.getMyAccount,
|
|
83
|
+
{}
|
|
84
|
+
);
|
|
85
|
+
if (account.id !== accountId) {
|
|
86
|
+
return [
|
|
87
|
+
new CapxulError({
|
|
88
|
+
code: "PERMISSION_DENIED",
|
|
89
|
+
message: "accounts.retrieve currently supports the authenticated caller's own account only.",
|
|
90
|
+
details: {
|
|
91
|
+
requestedAccountId: accountId,
|
|
92
|
+
authenticatedAccountId: account.id
|
|
93
|
+
}
|
|
94
|
+
}),
|
|
95
|
+
null
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
return [null, account];
|
|
99
|
+
} catch (cause) {
|
|
100
|
+
return [fromConvexError(cause), null];
|
|
101
|
+
}
|
|
102
|
+
},
|
|
77
103
|
lookup: async () => stub("accounts.lookup"),
|
|
78
|
-
update: async () =>
|
|
104
|
+
update: async (input) => {
|
|
105
|
+
if (!config.data) {
|
|
106
|
+
return stub("accounts.update");
|
|
107
|
+
}
|
|
108
|
+
if (input.countryCode !== void 0) {
|
|
109
|
+
return [
|
|
110
|
+
new CapxulError({
|
|
111
|
+
code: "INVALID_INPUT",
|
|
112
|
+
message: "accounts.update does not support countryCode yet \u2014 backend mutation only patches displayName and username.",
|
|
113
|
+
details: { field: "countryCode" }
|
|
114
|
+
}),
|
|
115
|
+
null
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const current = await config.data.query(
|
|
120
|
+
api.openfort.queries.getMyAccount,
|
|
121
|
+
{}
|
|
122
|
+
);
|
|
123
|
+
if (current.id !== input.accountId) {
|
|
124
|
+
return [
|
|
125
|
+
new CapxulError({
|
|
126
|
+
code: "PERMISSION_DENIED",
|
|
127
|
+
message: "accounts.update currently supports the authenticated caller's own account only.",
|
|
128
|
+
details: {
|
|
129
|
+
requestedAccountId: input.accountId,
|
|
130
|
+
authenticatedAccountId: current.id
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
null
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
await config.data.mutation(api.openfort.mutations.updateProfile, {
|
|
137
|
+
displayName: input.name,
|
|
138
|
+
username: input.username
|
|
139
|
+
});
|
|
140
|
+
const updated = await config.data.query(
|
|
141
|
+
api.openfort.queries.getMyAccount,
|
|
142
|
+
{}
|
|
143
|
+
);
|
|
144
|
+
return [null, updated];
|
|
145
|
+
} catch (cause) {
|
|
146
|
+
return [fromConvexError(cause), null];
|
|
147
|
+
}
|
|
148
|
+
},
|
|
79
149
|
provisionPersonal: async (input) => {
|
|
80
150
|
if (!config.data) {
|
|
81
151
|
return stub(
|
|
@@ -699,7 +769,34 @@ function createMeClient(config = {}) {
|
|
|
699
769
|
return [fromConvexError(cause), null];
|
|
700
770
|
}
|
|
701
771
|
},
|
|
702
|
-
update: async () =>
|
|
772
|
+
update: async (input) => {
|
|
773
|
+
if (!config.data) {
|
|
774
|
+
return stub("me.update");
|
|
775
|
+
}
|
|
776
|
+
if (input.countryCode !== void 0) {
|
|
777
|
+
return [
|
|
778
|
+
new CapxulError({
|
|
779
|
+
code: "INVALID_INPUT",
|
|
780
|
+
message: "me.update does not support countryCode yet \u2014 backend mutation only patches displayName and username.",
|
|
781
|
+
details: { field: "countryCode" }
|
|
782
|
+
}),
|
|
783
|
+
null
|
|
784
|
+
];
|
|
785
|
+
}
|
|
786
|
+
try {
|
|
787
|
+
await config.data.mutation(api.openfort.mutations.updateProfile, {
|
|
788
|
+
displayName: input.name,
|
|
789
|
+
username: input.username
|
|
790
|
+
});
|
|
791
|
+
const account = await config.data.query(
|
|
792
|
+
api.openfort.queries.getMyAccount,
|
|
793
|
+
{}
|
|
794
|
+
);
|
|
795
|
+
return [null, account];
|
|
796
|
+
} catch (cause) {
|
|
797
|
+
return [fromConvexError(cause), null];
|
|
798
|
+
}
|
|
799
|
+
}
|
|
703
800
|
};
|
|
704
801
|
}
|
|
705
802
|
|
|
@@ -1102,24 +1199,298 @@ function createOrgTransfersClient() {
|
|
|
1102
1199
|
cancel: async () => stub("organizations.transfers.cancel")
|
|
1103
1200
|
};
|
|
1104
1201
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
function createWithdrawalsClient() {
|
|
1202
|
+
var EVM_ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
1203
|
+
function createWithdrawalsClient(config = {}) {
|
|
1108
1204
|
return {
|
|
1109
|
-
create: async () =>
|
|
1110
|
-
|
|
1111
|
-
|
|
1205
|
+
create: async (input) => {
|
|
1206
|
+
if (!config.data) {
|
|
1207
|
+
return stub("withdrawals.create");
|
|
1208
|
+
}
|
|
1209
|
+
let created = null;
|
|
1210
|
+
let submitted = null;
|
|
1211
|
+
try {
|
|
1212
|
+
created = await config.data.mutation(
|
|
1213
|
+
api.withdrawals.mutations.create,
|
|
1214
|
+
{
|
|
1215
|
+
amount: input.amount,
|
|
1216
|
+
destination: {
|
|
1217
|
+
externalAccountId: input.destination.externalAccountId,
|
|
1218
|
+
kind: input.destination.kind
|
|
1219
|
+
},
|
|
1220
|
+
source: input.source,
|
|
1221
|
+
reference: input.reference,
|
|
1222
|
+
idempotencyKey: input.idempotencyKey
|
|
1223
|
+
}
|
|
1224
|
+
);
|
|
1225
|
+
if (!created) {
|
|
1226
|
+
return [
|
|
1227
|
+
new CapxulError({
|
|
1228
|
+
code: "NETWORK_ERROR",
|
|
1229
|
+
message: "withdrawals.create returned no withdrawal resource"
|
|
1230
|
+
}),
|
|
1231
|
+
null
|
|
1232
|
+
];
|
|
1233
|
+
}
|
|
1234
|
+
if (created.status !== "processing" || created.operation.status !== "processing") {
|
|
1235
|
+
return [null, created];
|
|
1236
|
+
}
|
|
1237
|
+
if (input.destination.kind !== "evm") {
|
|
1238
|
+
return [null, created];
|
|
1239
|
+
}
|
|
1240
|
+
if (!config.signer || !config.signing) {
|
|
1241
|
+
return [null, created];
|
|
1242
|
+
}
|
|
1243
|
+
if (!EVM_ADDRESS_RE.test(input.destination.externalAccountId)) {
|
|
1244
|
+
throw new CapxulError({
|
|
1245
|
+
code: "INVALID_INPUT",
|
|
1246
|
+
message: "destination.externalAccountId must be a 0x-prefixed EVM address while external_accounts resolution is pending (slice 1).",
|
|
1247
|
+
details: { field: "destination.externalAccountId" }
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
const currentSigner = await config.data.query(
|
|
1251
|
+
api.safe.queries.getMySignerAddress,
|
|
1252
|
+
{}
|
|
1253
|
+
);
|
|
1254
|
+
if (!currentSigner?.address) {
|
|
1255
|
+
throw new CapxulError({
|
|
1256
|
+
code: "PERMISSION_DENIED",
|
|
1257
|
+
message: "No signer is registered for the authenticated account.",
|
|
1258
|
+
details: { withdrawalId: created.id }
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
if (viem.getAddress(currentSigner.address) !== viem.getAddress(config.signer.address)) {
|
|
1262
|
+
throw new CapxulError({
|
|
1263
|
+
code: "PERMISSION_DENIED",
|
|
1264
|
+
message: "Configured signer does not match the authenticated account signer.",
|
|
1265
|
+
details: {
|
|
1266
|
+
withdrawalId: created.id,
|
|
1267
|
+
expectedSignerAddress: currentSigner.address,
|
|
1268
|
+
actualSignerAddress: config.signer.address
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
const submission = await config.data.query(
|
|
1273
|
+
api.withdrawals.queries.prepareSubmission,
|
|
1274
|
+
{ withdrawalId: created.id }
|
|
1275
|
+
);
|
|
1276
|
+
if (!submission?.externalAccountId) {
|
|
1277
|
+
throw new CapxulError({
|
|
1278
|
+
code: "NETWORK_ERROR",
|
|
1279
|
+
message: "withdrawals.prepareSubmission returned no destination.",
|
|
1280
|
+
details: { withdrawalId: created.id }
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
const transfer = await transferAsOwner(
|
|
1284
|
+
{
|
|
1285
|
+
signer: config.signer,
|
|
1286
|
+
signing: config.signing
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
tokenAddress: resolvePaymentTokenAddress(submission.amount.currency),
|
|
1290
|
+
recipientAddress: submission.externalAccountId,
|
|
1291
|
+
amount: toTokenUnits(submission.amount.value, 6)
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
if (!transfer.success) {
|
|
1295
|
+
throw new CapxulError({
|
|
1296
|
+
code: "NETWORK_ERROR",
|
|
1297
|
+
message: "Bundler submission did not succeed.",
|
|
1298
|
+
details: {
|
|
1299
|
+
withdrawalId: created.id,
|
|
1300
|
+
txHash: transfer.txHash,
|
|
1301
|
+
userOpHash: transfer.userOpHash
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
submitted = {
|
|
1306
|
+
txHash: transfer.txHash,
|
|
1307
|
+
userOpHash: transfer.userOpHash
|
|
1308
|
+
};
|
|
1309
|
+
await config.data.mutation(
|
|
1310
|
+
api.withdrawals.mutations.recordSubmitted,
|
|
1311
|
+
{
|
|
1312
|
+
withdrawalId: created.id,
|
|
1313
|
+
txHash: transfer.txHash,
|
|
1314
|
+
userOpHash: transfer.userOpHash
|
|
1315
|
+
}
|
|
1316
|
+
);
|
|
1317
|
+
return [null, created];
|
|
1318
|
+
} catch (cause) {
|
|
1319
|
+
const error = mapCreateError2(fromConvexError(cause));
|
|
1320
|
+
if (created?.id && created.status === "processing" && !submitted) {
|
|
1321
|
+
await bestEffortMarkFailed2({ data: config.data }, created.id, error);
|
|
1322
|
+
}
|
|
1323
|
+
if (submitted && created?.id) {
|
|
1324
|
+
return [
|
|
1325
|
+
new CapxulError({
|
|
1326
|
+
code: "NETWORK_ERROR",
|
|
1327
|
+
message: "Withdrawal was submitted on-chain, but backend submission tracking failed.",
|
|
1328
|
+
cause,
|
|
1329
|
+
details: {
|
|
1330
|
+
withdrawalId: created.id,
|
|
1331
|
+
txHash: submitted.txHash,
|
|
1332
|
+
userOpHash: submitted.userOpHash
|
|
1333
|
+
}
|
|
1334
|
+
}),
|
|
1335
|
+
null
|
|
1336
|
+
];
|
|
1337
|
+
}
|
|
1338
|
+
return [error, null];
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
retrieve: async (withdrawalId) => {
|
|
1342
|
+
if (!config.data) {
|
|
1343
|
+
return stub("withdrawals.retrieve");
|
|
1344
|
+
}
|
|
1345
|
+
try {
|
|
1346
|
+
const withdrawal = await config.data.query(
|
|
1347
|
+
api.withdrawals.queries.retrieve,
|
|
1348
|
+
{ withdrawalId }
|
|
1349
|
+
);
|
|
1350
|
+
if (!withdrawal) {
|
|
1351
|
+
return [
|
|
1352
|
+
new CapxulError({
|
|
1353
|
+
code: "NOT_FOUND",
|
|
1354
|
+
message: `withdrawal ${withdrawalId} not found`
|
|
1355
|
+
}),
|
|
1356
|
+
null
|
|
1357
|
+
];
|
|
1358
|
+
}
|
|
1359
|
+
return [null, withdrawal];
|
|
1360
|
+
} catch (cause) {
|
|
1361
|
+
return [
|
|
1362
|
+
fromConvexError(cause),
|
|
1363
|
+
null
|
|
1364
|
+
];
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
list: async (input) => {
|
|
1368
|
+
if (!config.data) {
|
|
1369
|
+
return stub("withdrawals.list");
|
|
1370
|
+
}
|
|
1371
|
+
try {
|
|
1372
|
+
const result = await config.data.query(
|
|
1373
|
+
api.withdrawals.queries.list,
|
|
1374
|
+
{
|
|
1375
|
+
limit: input?.limit,
|
|
1376
|
+
cursor: input?.cursor
|
|
1377
|
+
}
|
|
1378
|
+
);
|
|
1379
|
+
return [null, result];
|
|
1380
|
+
} catch (cause) {
|
|
1381
|
+
return [
|
|
1382
|
+
fromConvexError(cause),
|
|
1383
|
+
null
|
|
1384
|
+
];
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1112
1387
|
};
|
|
1113
1388
|
}
|
|
1114
|
-
function createOrgWithdrawalsClient() {
|
|
1389
|
+
function createOrgWithdrawalsClient(config = {}) {
|
|
1115
1390
|
return {
|
|
1391
|
+
// Slice 1 ships personal-scope only end-to-end; org-scope create
|
|
1392
|
+
// remains stubbed pending org-scoped backend mutation. List + retrieve
|
|
1393
|
+
// are wired through the org-aware query.
|
|
1116
1394
|
create: async () => stub(
|
|
1117
1395
|
"organizations.withdrawals.create"
|
|
1118
1396
|
),
|
|
1119
|
-
retrieve: async () =>
|
|
1120
|
-
|
|
1397
|
+
retrieve: async (input) => {
|
|
1398
|
+
if (!config.data) {
|
|
1399
|
+
return stub(
|
|
1400
|
+
"organizations.withdrawals.retrieve"
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
try {
|
|
1404
|
+
const withdrawal = await config.data.query(
|
|
1405
|
+
api.withdrawals.queries.retrieve,
|
|
1406
|
+
{ withdrawalId: input.withdrawalId }
|
|
1407
|
+
);
|
|
1408
|
+
if (!withdrawal) {
|
|
1409
|
+
return [
|
|
1410
|
+
new CapxulError({
|
|
1411
|
+
code: "NOT_FOUND",
|
|
1412
|
+
message: `withdrawal ${input.withdrawalId} not found`
|
|
1413
|
+
}),
|
|
1414
|
+
null
|
|
1415
|
+
];
|
|
1416
|
+
}
|
|
1417
|
+
const ownerCheck = withdrawal.owner;
|
|
1418
|
+
if (ownerCheck?.type !== "organization" || ownerCheck.id !== input.organizationId) {
|
|
1419
|
+
return [
|
|
1420
|
+
new CapxulError({
|
|
1421
|
+
code: "NOT_FOUND",
|
|
1422
|
+
message: `withdrawal ${input.withdrawalId} does not belong to organization ${input.organizationId}`
|
|
1423
|
+
}),
|
|
1424
|
+
null
|
|
1425
|
+
];
|
|
1426
|
+
}
|
|
1427
|
+
return [null, withdrawal];
|
|
1428
|
+
} catch (cause) {
|
|
1429
|
+
return [
|
|
1430
|
+
fromConvexError(cause),
|
|
1431
|
+
null
|
|
1432
|
+
];
|
|
1433
|
+
}
|
|
1434
|
+
},
|
|
1435
|
+
list: async (input) => {
|
|
1436
|
+
if (!config.data) {
|
|
1437
|
+
return stub(
|
|
1438
|
+
"organizations.withdrawals.list"
|
|
1439
|
+
);
|
|
1440
|
+
}
|
|
1441
|
+
try {
|
|
1442
|
+
const result = await config.data.query(
|
|
1443
|
+
api.withdrawals.queries.listOrg,
|
|
1444
|
+
{
|
|
1445
|
+
organizationId: input.organizationId,
|
|
1446
|
+
limit: input.limit,
|
|
1447
|
+
cursor: input.cursor
|
|
1448
|
+
}
|
|
1449
|
+
);
|
|
1450
|
+
return [null, result];
|
|
1451
|
+
} catch (cause) {
|
|
1452
|
+
return [
|
|
1453
|
+
fromConvexError(cause),
|
|
1454
|
+
null
|
|
1455
|
+
];
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1121
1458
|
};
|
|
1122
1459
|
}
|
|
1460
|
+
async function bestEffortMarkFailed2(config, withdrawalId, error) {
|
|
1461
|
+
try {
|
|
1462
|
+
await config.data.mutation(api.withdrawals.mutations.markFailed, {
|
|
1463
|
+
withdrawalId,
|
|
1464
|
+
errorCode: error.code,
|
|
1465
|
+
errorMessage: error.message
|
|
1466
|
+
});
|
|
1467
|
+
} catch {
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function mapCreateError2(error) {
|
|
1471
|
+
switch (error.code) {
|
|
1472
|
+
case "NOT_AUTHENTICATED":
|
|
1473
|
+
case "PERMISSION_DENIED":
|
|
1474
|
+
case "INVALID_INPUT":
|
|
1475
|
+
case "INSUFFICIENT_BALANCE":
|
|
1476
|
+
case "IDEMPOTENCY_CONFLICT":
|
|
1477
|
+
case "KYC_REQUIRED":
|
|
1478
|
+
case "POLICY_DENIED":
|
|
1479
|
+
case "RATE_LIMITED":
|
|
1480
|
+
case "NETWORK_ERROR":
|
|
1481
|
+
return error;
|
|
1482
|
+
default:
|
|
1483
|
+
return new CapxulError({
|
|
1484
|
+
code: "NETWORK_ERROR",
|
|
1485
|
+
message: error.message,
|
|
1486
|
+
cause: error,
|
|
1487
|
+
details: error.details,
|
|
1488
|
+
operationId: error.operationId,
|
|
1489
|
+
correlationId: error.correlationId,
|
|
1490
|
+
retryable: error.retryable
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1123
1494
|
|
|
1124
1495
|
// src/core/webhook-endpoints.ts
|
|
1125
1496
|
function createWebhookEndpointsClient() {
|
|
@@ -1219,7 +1590,7 @@ function createOrganizationsClient(config = {}) {
|
|
|
1219
1590
|
},
|
|
1220
1591
|
payments: createOrgPaymentsClient(),
|
|
1221
1592
|
transfers: createOrgTransfersClient(),
|
|
1222
|
-
withdrawals: createOrgWithdrawalsClient(),
|
|
1593
|
+
withdrawals: createOrgWithdrawalsClient(config),
|
|
1223
1594
|
documents: createOrgDocumentsClient(),
|
|
1224
1595
|
webhookEndpoints: createWebhookEndpointsClient(),
|
|
1225
1596
|
webhookEvents: createWebhookEventsClient()
|
|
@@ -1234,6 +1605,96 @@ function createSubAccountsClient() {
|
|
|
1234
1605
|
};
|
|
1235
1606
|
}
|
|
1236
1607
|
|
|
1608
|
+
// src/core/token-transfers.ts
|
|
1609
|
+
var toTokenTransferId = (raw) => {
|
|
1610
|
+
if (typeof raw !== "string" || raw.length === 0) {
|
|
1611
|
+
throw new Error(
|
|
1612
|
+
`Invalid tokenTransferId: expected non-empty string, got ${String(raw)}`
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
return raw;
|
|
1616
|
+
};
|
|
1617
|
+
function brandRow(row) {
|
|
1618
|
+
return {
|
|
1619
|
+
...row,
|
|
1620
|
+
id: toTokenTransferId(row.id)
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
function createTokenTransfersClient(config = {}) {
|
|
1624
|
+
return {
|
|
1625
|
+
list: async (input) => {
|
|
1626
|
+
if (!config.data) {
|
|
1627
|
+
return stub("tokenTransfers.list");
|
|
1628
|
+
}
|
|
1629
|
+
try {
|
|
1630
|
+
const raw = await config.data.query(
|
|
1631
|
+
api.tokenTransfers.queries.list,
|
|
1632
|
+
{
|
|
1633
|
+
limit: input?.limit,
|
|
1634
|
+
cursor: input?.cursor,
|
|
1635
|
+
direction: input?.direction
|
|
1636
|
+
}
|
|
1637
|
+
);
|
|
1638
|
+
if (!raw) {
|
|
1639
|
+
return [
|
|
1640
|
+
new CapxulError({
|
|
1641
|
+
code: "NOT_AUTHENTICATED",
|
|
1642
|
+
message: "tokenTransfers.list requires an authenticated session."
|
|
1643
|
+
}),
|
|
1644
|
+
null
|
|
1645
|
+
];
|
|
1646
|
+
}
|
|
1647
|
+
return [
|
|
1648
|
+
null,
|
|
1649
|
+
{
|
|
1650
|
+
object: "list",
|
|
1651
|
+
data: raw.items.map(brandRow),
|
|
1652
|
+
page: {
|
|
1653
|
+
hasMore: raw.hasMore,
|
|
1654
|
+
nextCursor: raw.nextCursor
|
|
1655
|
+
},
|
|
1656
|
+
displayCurrency: raw.displayCurrency
|
|
1657
|
+
}
|
|
1658
|
+
];
|
|
1659
|
+
} catch (cause) {
|
|
1660
|
+
return [fromConvexError(cause), null];
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
retrieve: async (input) => {
|
|
1664
|
+
if (!config.data) {
|
|
1665
|
+
return stub("tokenTransfers.retrieve");
|
|
1666
|
+
}
|
|
1667
|
+
try {
|
|
1668
|
+
const raw = await config.data.query(
|
|
1669
|
+
api.tokenTransfers.queries.getByTxLogIndex,
|
|
1670
|
+
{
|
|
1671
|
+
txHash: input.txHash,
|
|
1672
|
+
logIndex: input.logIndex,
|
|
1673
|
+
chainId: input.chainId
|
|
1674
|
+
}
|
|
1675
|
+
);
|
|
1676
|
+
if (!raw) {
|
|
1677
|
+
return [
|
|
1678
|
+
new CapxulError({
|
|
1679
|
+
code: "NOT_FOUND",
|
|
1680
|
+
message: `tokenTransfer (txHash=${input.txHash}, logIndex=${input.logIndex}) not found or not visible to caller.`,
|
|
1681
|
+
details: {
|
|
1682
|
+
txHash: input.txHash,
|
|
1683
|
+
logIndex: input.logIndex,
|
|
1684
|
+
chainId: input.chainId
|
|
1685
|
+
}
|
|
1686
|
+
}),
|
|
1687
|
+
null
|
|
1688
|
+
];
|
|
1689
|
+
}
|
|
1690
|
+
return [null, brandRow(raw)];
|
|
1691
|
+
} catch (cause) {
|
|
1692
|
+
return [fromConvexError(cause), null];
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1237
1698
|
// src/core/virtual-accounts.ts
|
|
1238
1699
|
function createVirtualAccountsClient() {
|
|
1239
1700
|
return {
|
|
@@ -2085,7 +2546,8 @@ function createCapxulClient(config = {}) {
|
|
|
2085
2546
|
organizations: createOrganizationsClient(config),
|
|
2086
2547
|
payments: createPaymentsClient(config),
|
|
2087
2548
|
transfers: createTransfersClient(),
|
|
2088
|
-
|
|
2549
|
+
tokenTransfers: createTokenTransfersClient(config),
|
|
2550
|
+
withdrawals: createWithdrawalsClient(config),
|
|
2089
2551
|
documents: createDocumentsClient(),
|
|
2090
2552
|
subAccounts: createSubAccountsClient(),
|
|
2091
2553
|
virtualAccounts: createVirtualAccountsClient(),
|
|
@@ -2228,6 +2690,7 @@ exports.toPaymentId = toPaymentId;
|
|
|
2228
2690
|
exports.toPhoneNumber = toPhoneNumber;
|
|
2229
2691
|
exports.toSafeId = toSafeId;
|
|
2230
2692
|
exports.toSubAccountId = toSubAccountId;
|
|
2693
|
+
exports.toTokenTransferId = toTokenTransferId;
|
|
2231
2694
|
exports.toTransferId = toTransferId;
|
|
2232
2695
|
exports.toTreasuryId = toTreasuryId;
|
|
2233
2696
|
exports.toUsername = toUsername;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-
|
|
2
|
-
export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as
|
|
1
|
+
import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-CXRKtbfn.cjs';
|
|
2
|
+
export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as TokenTransfer, s as TokenTransferId, t as TokenTransfersClient, u as TokenTransfersListInput, v as TokenTransfersListPage, w as TokenTransfersRetrieveInput, x as TransfersClient, y as TransportRuntime, z as TransportState, V as VirtualAccountsClient, F as VirtualCardsClient, W as WebhookEndpointCreateResult, G as WebhookEndpointsClient, I as WebhookEventsClient, J as WithdrawalsClient, K as createCapxulClient, N as makeHttpTransport, Q as toTokenTransferId } from './client-CXRKtbfn.cjs';
|
|
3
3
|
import * as xstate from 'xstate';
|
|
4
4
|
import { E as Email, U as Username, O as OperationId, N as NextAction } from './next-action-DkrwXYay.cjs';
|
|
5
5
|
export { A as AccountId, a as ApiKeyId, B as BalanceLedgerEntryId, C as CorrelationId, D as DocumentId, b as ExternalAccountId, K as KybProfileId, c as KycProfileId, M as MemberId, d as OrganizationId, P as PaymentId, e as PhoneNumber, S as SafeId, f as SubAccountId, T as TransactionIntentId, g as TransferId, h as TreasuryId, V as VirtualAccountId, i as VirtualCardId, W as WebhookEndpointId, j as WebhookEventId, k as WithdrawalId, t as toAccountId, l as toApiKeyId, m as toBalanceLedgerEntryId, n as toDocumentId, o as toEmail, p as toExternalAccountId, q as toKybProfileId, r as toKycProfileId, s as toMemberId, u as toOperationId, v as toOrganizationId, w as toPaymentId, x as toPhoneNumber, y as toSafeId, z as toSubAccountId, F as toTransferId, G as toTreasuryId, H as toUsername, I as toVirtualAccountId, J as toVirtualCardId, L as toWebhookEndpointId, Q as toWebhookEventId, R as toWithdrawalId } from './next-action-DkrwXYay.cjs';
|
|
6
6
|
import { C as CapxulError$1, a as CapxulErrorCode$1 } from './errors-GgKrSUKp.cjs';
|
|
7
7
|
export { b as CapxulErrorDetails, c as CapxulErrorEnvelope, d as CapxulResult } from './errors-GgKrSUKp.cjs';
|
|
8
|
-
import { A as Account } from './types-
|
|
9
|
-
export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-
|
|
8
|
+
import { A as Account } from './types-DVWojoy4.cjs';
|
|
9
|
+
export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-DVWojoy4.cjs';
|
|
10
10
|
import { Account as Account$1 } from 'viem';
|
|
11
11
|
export { WebhookVerificationOptions, WebhookVerificationResult, verifyWebhook } from './webhooks.cjs';
|
|
12
12
|
import '@repo/api-contract/gen/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-
|
|
2
|
-
export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as
|
|
1
|
+
import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-CcCtq5XO.js';
|
|
2
|
+
export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as TokenTransfer, s as TokenTransferId, t as TokenTransfersClient, u as TokenTransfersListInput, v as TokenTransfersListPage, w as TokenTransfersRetrieveInput, x as TransfersClient, y as TransportRuntime, z as TransportState, V as VirtualAccountsClient, F as VirtualCardsClient, W as WebhookEndpointCreateResult, G as WebhookEndpointsClient, I as WebhookEventsClient, J as WithdrawalsClient, K as createCapxulClient, N as makeHttpTransport, Q as toTokenTransferId } from './client-CcCtq5XO.js';
|
|
3
3
|
import * as xstate from 'xstate';
|
|
4
4
|
import { E as Email, U as Username, O as OperationId, N as NextAction } from './next-action-DkrwXYay.js';
|
|
5
5
|
export { A as AccountId, a as ApiKeyId, B as BalanceLedgerEntryId, C as CorrelationId, D as DocumentId, b as ExternalAccountId, K as KybProfileId, c as KycProfileId, M as MemberId, d as OrganizationId, P as PaymentId, e as PhoneNumber, S as SafeId, f as SubAccountId, T as TransactionIntentId, g as TransferId, h as TreasuryId, V as VirtualAccountId, i as VirtualCardId, W as WebhookEndpointId, j as WebhookEventId, k as WithdrawalId, t as toAccountId, l as toApiKeyId, m as toBalanceLedgerEntryId, n as toDocumentId, o as toEmail, p as toExternalAccountId, q as toKybProfileId, r as toKycProfileId, s as toMemberId, u as toOperationId, v as toOrganizationId, w as toPaymentId, x as toPhoneNumber, y as toSafeId, z as toSubAccountId, F as toTransferId, G as toTreasuryId, H as toUsername, I as toVirtualAccountId, J as toVirtualCardId, L as toWebhookEndpointId, Q as toWebhookEventId, R as toWithdrawalId } from './next-action-DkrwXYay.js';
|
|
6
6
|
import { C as CapxulError$1, a as CapxulErrorCode$1 } from './errors-QHD5Tlok.js';
|
|
7
7
|
export { b as CapxulErrorDetails, c as CapxulErrorEnvelope, d as CapxulResult } from './errors-QHD5Tlok.js';
|
|
8
|
-
import { A as Account } from './types-
|
|
9
|
-
export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-
|
|
8
|
+
import { A as Account } from './types-75UokagF.js';
|
|
9
|
+
export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-75UokagF.js';
|
|
10
10
|
import { Account as Account$1 } from 'viem';
|
|
11
11
|
export { WebhookVerificationOptions, WebhookVerificationResult, verifyWebhook } from './webhooks.js';
|
|
12
12
|
import '@repo/api-contract/gen/types';
|