@capxul/sdk 2.1.0 → 2.1.1
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/{create-capxul-client-DmV6qEq4.d.mts → create-capxul-client-BI-6Za6X.d.mts} +8 -6
- package/dist/{create-capxul-client-CMUq5w10.mjs → create-capxul-client-CPhTPz_9.mjs} +147 -147
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.mjs +1 -1
- package/package.json +4 -4
|
@@ -381,7 +381,7 @@ declare const AttachablePaymentDocumentEnvelope: Schema.Union<readonly [Schema.S
|
|
|
381
381
|
readonly name: Schema.Literal<"CapxulPayments">;
|
|
382
382
|
readonly version: Schema.Literal<"1">;
|
|
383
383
|
readonly chainId: Schema.Codec<ChainId, number, never, never>;
|
|
384
|
-
readonly verifyingContract: Schema.Literal<"
|
|
384
|
+
readonly verifyingContract: Schema.Literal<"0xA3ACDD016f706eD432A9a0545C45F0943f996b60">;
|
|
385
385
|
}>;
|
|
386
386
|
readonly primaryType: Schema.Literal<"Memo">;
|
|
387
387
|
readonly message: Schema.Struct<{
|
|
@@ -397,7 +397,7 @@ declare const AttachablePaymentDocumentEnvelope: Schema.Union<readonly [Schema.S
|
|
|
397
397
|
readonly name: Schema.Literal<"CapxulPayments">;
|
|
398
398
|
readonly version: Schema.Literal<"1">;
|
|
399
399
|
readonly chainId: Schema.Codec<ChainId, number, never, never>;
|
|
400
|
-
readonly verifyingContract: Schema.Literal<"
|
|
400
|
+
readonly verifyingContract: Schema.Literal<"0xA3ACDD016f706eD432A9a0545C45F0943f996b60">;
|
|
401
401
|
}>;
|
|
402
402
|
readonly primaryType: Schema.Literal<"Invoice">;
|
|
403
403
|
readonly message: Schema.Struct<{
|
|
@@ -419,7 +419,7 @@ declare const AttachablePaymentDocumentEnvelope: Schema.Union<readonly [Schema.S
|
|
|
419
419
|
readonly name: Schema.Literal<"CapxulPayments">;
|
|
420
420
|
readonly version: Schema.Literal<"1">;
|
|
421
421
|
readonly chainId: Schema.Codec<ChainId, number, never, never>;
|
|
422
|
-
readonly verifyingContract: Schema.Literal<"
|
|
422
|
+
readonly verifyingContract: Schema.Literal<"0xA3ACDD016f706eD432A9a0545C45F0943f996b60">;
|
|
423
423
|
}>;
|
|
424
424
|
readonly primaryType: Schema.Literal<"Payslip">;
|
|
425
425
|
readonly message: Schema.Struct<{
|
|
@@ -440,7 +440,7 @@ declare const AttachablePaymentDocumentEnvelope: Schema.Union<readonly [Schema.S
|
|
|
440
440
|
readonly name: Schema.Literal<"CapxulPayments">;
|
|
441
441
|
readonly version: Schema.Literal<"1">;
|
|
442
442
|
readonly chainId: Schema.Codec<ChainId, number, never, never>;
|
|
443
|
-
readonly verifyingContract: Schema.Literal<"
|
|
443
|
+
readonly verifyingContract: Schema.Literal<"0xA3ACDD016f706eD432A9a0545C45F0943f996b60">;
|
|
444
444
|
}>;
|
|
445
445
|
readonly primaryType: Schema.Literal<"Receipt">;
|
|
446
446
|
readonly message: Schema.Struct<{
|
|
@@ -1084,6 +1084,10 @@ type AccountLifecycle = {
|
|
|
1084
1084
|
};
|
|
1085
1085
|
declare function isSettingUpLifecycle(lifecycle: AccountLifecycle): boolean;
|
|
1086
1086
|
//#endregion
|
|
1087
|
+
//#region src/surface/payment-command-execution.d.ts
|
|
1088
|
+
/** Return one stable fingerprint for one JSON payment intent. */
|
|
1089
|
+
declare function fingerprintPaymentIntent(intent: unknown): Promise<string>;
|
|
1090
|
+
//#endregion
|
|
1087
1091
|
//#region src/surface/money.d.ts
|
|
1088
1092
|
type ActorReference = {
|
|
1089
1093
|
readonly kind: "personal";
|
|
@@ -1278,8 +1282,6 @@ interface PaymentsPayInput {
|
|
|
1278
1282
|
*/
|
|
1279
1283
|
readonly lineItems?: readonly LineItemV1[];
|
|
1280
1284
|
}
|
|
1281
|
-
/** Return one stable fingerprint for one JSON payment intent. */
|
|
1282
|
-
declare function fingerprintPaymentIntent(intent: unknown): Promise<string>;
|
|
1283
1285
|
type DestinationKind = "bank_account" | "mobile_money" | "external_account";
|
|
1284
1286
|
type DestinationRail = {
|
|
1285
1287
|
readonly kind: "bank";
|
|
@@ -572,144 +572,6 @@ function normalizeBindingEmail(email) {
|
|
|
572
572
|
return normalizeSafeSaltEmail(email);
|
|
573
573
|
}
|
|
574
574
|
//#endregion
|
|
575
|
-
//#region ../config/src/route.ts
|
|
576
|
-
/** USDX on Base Sepolia — the only settlement token in v1. */
|
|
577
|
-
const USDX_BASE_SEPOLIA_TOKEN = {
|
|
578
|
-
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
579
|
-
address: USDX_ADDRESS_BASE_SEPOLIA,
|
|
580
|
-
decimals: 6
|
|
581
|
-
};
|
|
582
|
-
USDX_BASE_SEPOLIA_TOKEN.chainId;
|
|
583
|
-
USDX_BASE_SEPOLIA_TOKEN.chainId;
|
|
584
|
-
//#endregion
|
|
585
|
-
//#region ../config/src/role-dsl.ts
|
|
586
|
-
const USD_DECIMALS = 6;
|
|
587
|
-
const USD_SCALE = 10n ** BigInt(USD_DECIMALS);
|
|
588
|
-
const USD_DISPLAY_RE = /^\d+(?:\.\d{1,6})?$/;
|
|
589
|
-
const USD_BASE_UNIT_RE = /^\d+$/;
|
|
590
|
-
const EXEC_TRANSACTION_WITH_ROLE = "zodiac.roles.execTransactionWithRole";
|
|
591
|
-
const ASSIGN_ROLES = "zodiac.roles.assignRoles";
|
|
592
|
-
const SCOPE_TARGET = "zodiac.roles.scopeTarget";
|
|
593
|
-
const OWNER_ROLE_LABEL = "Owner";
|
|
594
|
-
const FOUNDER_BUDGET_ROLE_LABEL = "Founder Budget";
|
|
595
|
-
const FOUNDER_BUDGET_LIMIT = {
|
|
596
|
-
currency: "USD",
|
|
597
|
-
value: "1000000000000",
|
|
598
|
-
decimals: 6
|
|
599
|
-
};
|
|
600
|
-
function usd(value) {
|
|
601
|
-
return {
|
|
602
|
-
currency: "USD",
|
|
603
|
-
value: usdDisplayToBaseUnits(value),
|
|
604
|
-
decimals: USD_DECIMALS
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
function usdDisplayToBaseUnits(value) {
|
|
608
|
-
if (value.trim() !== value || !USD_DISPLAY_RE.test(value)) throw Errors.invalidInput("role.spend", "USD caps must be unsigned decimal strings with at most 6 fractional digits");
|
|
609
|
-
const parts = value.split(".");
|
|
610
|
-
const whole = parts[0] ?? "0";
|
|
611
|
-
const fraction = parts[1] ?? "";
|
|
612
|
-
return (BigInt(whole) * USD_SCALE + BigInt(fraction.padEnd(USD_DECIMALS, "0"))).toString();
|
|
613
|
-
}
|
|
614
|
-
function normalizeOrgRoleMoney(money, field) {
|
|
615
|
-
if (money.currency !== "USD" || money.decimals !== USD_DECIMALS || !USD_BASE_UNIT_RE.test(money.value)) throw Errors.invalidInput(field, `must be USD base units with ${USD_DECIMALS} decimals`);
|
|
616
|
-
return money;
|
|
617
|
-
}
|
|
618
|
-
function normalizeOrgRoleSpendCap(spend) {
|
|
619
|
-
if (spend === void 0) return void 0;
|
|
620
|
-
return {
|
|
621
|
-
...spend.perTx === void 0 ? {} : { perTx: normalizeOrgRoleMoney(spend.perTx, "roles.spend.perTx") },
|
|
622
|
-
...spend.perDay === void 0 ? {} : { perDay: normalizeOrgRoleMoney(spend.perDay, "roles.spend.perDay") },
|
|
623
|
-
...spend.toRecipients === void 0 ? {} : { toRecipients: spend.toRecipients }
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
function normalizeOrgRoleLabel(label) {
|
|
627
|
-
const normalized = label.trim().replace(/\s+/g, " ");
|
|
628
|
-
if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
|
|
629
|
-
return normalized;
|
|
630
|
-
}
|
|
631
|
-
function orgRoleKeyForLabel(label) {
|
|
632
|
-
return keccak256(toBytes(normalizeOrgRoleLabel(label).toLowerCase()));
|
|
633
|
-
}
|
|
634
|
-
function soloOrgRoleTemplate() {
|
|
635
|
-
return [{
|
|
636
|
-
label: "Owner",
|
|
637
|
-
canManageMembers: true,
|
|
638
|
-
canManageRoles: true
|
|
639
|
-
}, {
|
|
640
|
-
label: FOUNDER_BUDGET_ROLE_LABEL,
|
|
641
|
-
spend: {
|
|
642
|
-
perTx: FOUNDER_BUDGET_LIMIT,
|
|
643
|
-
perDay: FOUNDER_BUDGET_LIMIT,
|
|
644
|
-
toRecipients: "anyone"
|
|
645
|
-
}
|
|
646
|
-
}];
|
|
647
|
-
}
|
|
648
|
-
function startupOrgRoleTemplate() {
|
|
649
|
-
return [
|
|
650
|
-
...soloOrgRoleTemplate(),
|
|
651
|
-
{
|
|
652
|
-
label: "Finance Manager",
|
|
653
|
-
spend: {
|
|
654
|
-
perTx: usd("25000"),
|
|
655
|
-
perDay: usd("100000"),
|
|
656
|
-
toRecipients: "anyone"
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
label: "Team Lead",
|
|
661
|
-
spend: {
|
|
662
|
-
perTx: usd("5000"),
|
|
663
|
-
perDay: usd("15000"),
|
|
664
|
-
toRecipients: "anyone"
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
];
|
|
668
|
-
}
|
|
669
|
-
function orgRoleTemplateDefinitions(template, customRoles = []) {
|
|
670
|
-
switch (template) {
|
|
671
|
-
case "Solo": return soloOrgRoleTemplate();
|
|
672
|
-
case "Startup": return startupOrgRoleTemplate();
|
|
673
|
-
case "Custom": return customRoles.length === 0 ? soloOrgRoleTemplate() : customRoles;
|
|
674
|
-
default: return template;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
function compileOrgRoleDefinitions(definitions) {
|
|
678
|
-
if (definitions.length === 0) throw Errors.invalidInput("roles", "must include at least one role");
|
|
679
|
-
const seen = /* @__PURE__ */ new Set();
|
|
680
|
-
const roles = definitions.map((definition) => {
|
|
681
|
-
const label = normalizeOrgRoleLabel(definition.label);
|
|
682
|
-
const roleKey = orgRoleKeyForLabel(label);
|
|
683
|
-
if (seen.has(roleKey)) throw Errors.invalidInput("roles", `duplicate role label: ${label}`);
|
|
684
|
-
seen.add(roleKey);
|
|
685
|
-
const spend = normalizeOrgRoleSpendCap(definition.spend);
|
|
686
|
-
const permissions = [];
|
|
687
|
-
if (spend !== void 0 || label === OWNER_ROLE_LABEL) permissions.push(EXEC_TRANSACTION_WITH_ROLE);
|
|
688
|
-
if (definition.canManageMembers === true) permissions.push(ASSIGN_ROLES);
|
|
689
|
-
if (definition.canManageRoles === true) permissions.push(SCOPE_TARGET);
|
|
690
|
-
return {
|
|
691
|
-
label,
|
|
692
|
-
roleKey,
|
|
693
|
-
definition: {
|
|
694
|
-
...definition,
|
|
695
|
-
label,
|
|
696
|
-
...spend === void 0 ? {} : { spend }
|
|
697
|
-
},
|
|
698
|
-
permissions,
|
|
699
|
-
allowance: spend ?? null
|
|
700
|
-
};
|
|
701
|
-
});
|
|
702
|
-
const manager = roles.find((role) => role.definition.canManageMembers === true);
|
|
703
|
-
if (manager === void 0) throw Errors.invalidInput("roles.canManageMembers", "at least one role must compile to the on-chain member-management permission");
|
|
704
|
-
return {
|
|
705
|
-
roles,
|
|
706
|
-
memberManagementRole: {
|
|
707
|
-
roleKey: manager.roleKey,
|
|
708
|
-
permission: ASSIGN_ROLES
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
//#endregion
|
|
713
575
|
//#region ../config/src/capxul-payments-v2.ts
|
|
714
576
|
/** The exact compiled CapxulPaymentsV2 ABI. */
|
|
715
577
|
const CAPXUL_PAYMENTS_V2_ABI = [
|
|
@@ -1337,6 +1199,144 @@ const CAPXUL_PAYMENTS_V2_ABI = [
|
|
|
1337
1199
|
];
|
|
1338
1200
|
/** Immutable CapxulPaymentsV2 deployment on Base Sepolia. */
|
|
1339
1201
|
const CAPXUL_PAYMENTS_V2_ADDRESS = "0xA3ACDD016f706eD432A9a0545C45F0943f996b60";
|
|
1202
|
+
//#endregion
|
|
1203
|
+
//#region ../config/src/route.ts
|
|
1204
|
+
/** USDX on Base Sepolia — the only settlement token in v1. */
|
|
1205
|
+
const USDX_BASE_SEPOLIA_TOKEN = {
|
|
1206
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
1207
|
+
address: USDX_ADDRESS_BASE_SEPOLIA,
|
|
1208
|
+
decimals: 6
|
|
1209
|
+
};
|
|
1210
|
+
USDX_BASE_SEPOLIA_TOKEN.chainId;
|
|
1211
|
+
USDX_BASE_SEPOLIA_TOKEN.chainId;
|
|
1212
|
+
//#endregion
|
|
1213
|
+
//#region ../config/src/role-dsl.ts
|
|
1214
|
+
const USD_DECIMALS = 6;
|
|
1215
|
+
const USD_SCALE = 10n ** BigInt(USD_DECIMALS);
|
|
1216
|
+
const USD_DISPLAY_RE = /^\d+(?:\.\d{1,6})?$/;
|
|
1217
|
+
const USD_BASE_UNIT_RE = /^\d+$/;
|
|
1218
|
+
const EXEC_TRANSACTION_WITH_ROLE = "zodiac.roles.execTransactionWithRole";
|
|
1219
|
+
const ASSIGN_ROLES = "zodiac.roles.assignRoles";
|
|
1220
|
+
const SCOPE_TARGET = "zodiac.roles.scopeTarget";
|
|
1221
|
+
const OWNER_ROLE_LABEL = "Owner";
|
|
1222
|
+
const FOUNDER_BUDGET_ROLE_LABEL = "Founder Budget";
|
|
1223
|
+
const FOUNDER_BUDGET_LIMIT = {
|
|
1224
|
+
currency: "USD",
|
|
1225
|
+
value: "1000000000000",
|
|
1226
|
+
decimals: 6
|
|
1227
|
+
};
|
|
1228
|
+
function usd(value) {
|
|
1229
|
+
return {
|
|
1230
|
+
currency: "USD",
|
|
1231
|
+
value: usdDisplayToBaseUnits(value),
|
|
1232
|
+
decimals: USD_DECIMALS
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function usdDisplayToBaseUnits(value) {
|
|
1236
|
+
if (value.trim() !== value || !USD_DISPLAY_RE.test(value)) throw Errors.invalidInput("role.spend", "USD caps must be unsigned decimal strings with at most 6 fractional digits");
|
|
1237
|
+
const parts = value.split(".");
|
|
1238
|
+
const whole = parts[0] ?? "0";
|
|
1239
|
+
const fraction = parts[1] ?? "";
|
|
1240
|
+
return (BigInt(whole) * USD_SCALE + BigInt(fraction.padEnd(USD_DECIMALS, "0"))).toString();
|
|
1241
|
+
}
|
|
1242
|
+
function normalizeOrgRoleMoney(money, field) {
|
|
1243
|
+
if (money.currency !== "USD" || money.decimals !== USD_DECIMALS || !USD_BASE_UNIT_RE.test(money.value)) throw Errors.invalidInput(field, `must be USD base units with ${USD_DECIMALS} decimals`);
|
|
1244
|
+
return money;
|
|
1245
|
+
}
|
|
1246
|
+
function normalizeOrgRoleSpendCap(spend) {
|
|
1247
|
+
if (spend === void 0) return void 0;
|
|
1248
|
+
return {
|
|
1249
|
+
...spend.perTx === void 0 ? {} : { perTx: normalizeOrgRoleMoney(spend.perTx, "roles.spend.perTx") },
|
|
1250
|
+
...spend.perDay === void 0 ? {} : { perDay: normalizeOrgRoleMoney(spend.perDay, "roles.spend.perDay") },
|
|
1251
|
+
...spend.toRecipients === void 0 ? {} : { toRecipients: spend.toRecipients }
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
function normalizeOrgRoleLabel(label) {
|
|
1255
|
+
const normalized = label.trim().replace(/\s+/g, " ");
|
|
1256
|
+
if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
|
|
1257
|
+
return normalized;
|
|
1258
|
+
}
|
|
1259
|
+
function orgRoleKeyForLabel(label) {
|
|
1260
|
+
return keccak256(toBytes(normalizeOrgRoleLabel(label).toLowerCase()));
|
|
1261
|
+
}
|
|
1262
|
+
function soloOrgRoleTemplate() {
|
|
1263
|
+
return [{
|
|
1264
|
+
label: "Owner",
|
|
1265
|
+
canManageMembers: true,
|
|
1266
|
+
canManageRoles: true
|
|
1267
|
+
}, {
|
|
1268
|
+
label: FOUNDER_BUDGET_ROLE_LABEL,
|
|
1269
|
+
spend: {
|
|
1270
|
+
perTx: FOUNDER_BUDGET_LIMIT,
|
|
1271
|
+
perDay: FOUNDER_BUDGET_LIMIT,
|
|
1272
|
+
toRecipients: "anyone"
|
|
1273
|
+
}
|
|
1274
|
+
}];
|
|
1275
|
+
}
|
|
1276
|
+
function startupOrgRoleTemplate() {
|
|
1277
|
+
return [
|
|
1278
|
+
...soloOrgRoleTemplate(),
|
|
1279
|
+
{
|
|
1280
|
+
label: "Finance Manager",
|
|
1281
|
+
spend: {
|
|
1282
|
+
perTx: usd("25000"),
|
|
1283
|
+
perDay: usd("100000"),
|
|
1284
|
+
toRecipients: "anyone"
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
label: "Team Lead",
|
|
1289
|
+
spend: {
|
|
1290
|
+
perTx: usd("5000"),
|
|
1291
|
+
perDay: usd("15000"),
|
|
1292
|
+
toRecipients: "anyone"
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
];
|
|
1296
|
+
}
|
|
1297
|
+
function orgRoleTemplateDefinitions(template, customRoles = []) {
|
|
1298
|
+
switch (template) {
|
|
1299
|
+
case "Solo": return soloOrgRoleTemplate();
|
|
1300
|
+
case "Startup": return startupOrgRoleTemplate();
|
|
1301
|
+
case "Custom": return customRoles.length === 0 ? soloOrgRoleTemplate() : customRoles;
|
|
1302
|
+
default: return template;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function compileOrgRoleDefinitions(definitions) {
|
|
1306
|
+
if (definitions.length === 0) throw Errors.invalidInput("roles", "must include at least one role");
|
|
1307
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1308
|
+
const roles = definitions.map((definition) => {
|
|
1309
|
+
const label = normalizeOrgRoleLabel(definition.label);
|
|
1310
|
+
const roleKey = orgRoleKeyForLabel(label);
|
|
1311
|
+
if (seen.has(roleKey)) throw Errors.invalidInput("roles", `duplicate role label: ${label}`);
|
|
1312
|
+
seen.add(roleKey);
|
|
1313
|
+
const spend = normalizeOrgRoleSpendCap(definition.spend);
|
|
1314
|
+
const permissions = [];
|
|
1315
|
+
if (spend !== void 0 || label === OWNER_ROLE_LABEL) permissions.push(EXEC_TRANSACTION_WITH_ROLE);
|
|
1316
|
+
if (definition.canManageMembers === true) permissions.push(ASSIGN_ROLES);
|
|
1317
|
+
if (definition.canManageRoles === true) permissions.push(SCOPE_TARGET);
|
|
1318
|
+
return {
|
|
1319
|
+
label,
|
|
1320
|
+
roleKey,
|
|
1321
|
+
definition: {
|
|
1322
|
+
...definition,
|
|
1323
|
+
label,
|
|
1324
|
+
...spend === void 0 ? {} : { spend }
|
|
1325
|
+
},
|
|
1326
|
+
permissions,
|
|
1327
|
+
allowance: spend ?? null
|
|
1328
|
+
};
|
|
1329
|
+
});
|
|
1330
|
+
const manager = roles.find((role) => role.definition.canManageMembers === true);
|
|
1331
|
+
if (manager === void 0) throw Errors.invalidInput("roles.canManageMembers", "at least one role must compile to the on-chain member-management permission");
|
|
1332
|
+
return {
|
|
1333
|
+
roles,
|
|
1334
|
+
memberManagementRole: {
|
|
1335
|
+
roleKey: manager.roleKey,
|
|
1336
|
+
permission: ASSIGN_ROLES
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
1340
|
padHex(stringToHex("FM_DAILY"), {
|
|
1341
1341
|
size: 32,
|
|
1342
1342
|
dir: "right"
|
|
@@ -2532,7 +2532,7 @@ const EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
|
2532
2532
|
* envelopes carrying it — so it MUST stay byte-identical across both. Exported
|
|
2533
2533
|
* once here to remove the drift risk of a mirrored declaration.
|
|
2534
2534
|
*/
|
|
2535
|
-
const PAYMENT_DOCUMENT_VERIFYING_CONTRACT = "
|
|
2535
|
+
const PAYMENT_DOCUMENT_VERIFYING_CONTRACT = "0xA3ACDD016f706eD432A9a0545C45F0943f996b60";
|
|
2536
2536
|
const PAYMENT_ID_RE = /^payment_[0-9A-Za-z]+$/;
|
|
2537
2537
|
const PAYEE_ID_RE = /^payee_[0-9A-Za-z]+$/;
|
|
2538
2538
|
const ORG_ID_RE = /^org_[0-9A-Za-z]+$/;
|
|
@@ -4803,6 +4803,12 @@ function signerFailure(operation, cause) {
|
|
|
4803
4803
|
error: cause instanceof CapxulError ? cause : Errors.providerError("wallet-signer", operation, cause)
|
|
4804
4804
|
};
|
|
4805
4805
|
}
|
|
4806
|
+
/** Return one stable fingerprint for one JSON payment intent. */
|
|
4807
|
+
async function fingerprintPaymentIntent(intent) {
|
|
4808
|
+
const canonical = JSON.stringify(intent, (_key, value) => value !== null && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right))) : value);
|
|
4809
|
+
if (canonical === void 0) throw new TypeError("Payment intent must be JSON data");
|
|
4810
|
+
return keccak256(toBytes(canonical));
|
|
4811
|
+
}
|
|
4806
4812
|
async function executePrepared(deps, prepare, expectedRequest, signal) {
|
|
4807
4813
|
if (isAborted$1(signal)) return {
|
|
4808
4814
|
ok: false,
|
|
@@ -4821,7 +4827,7 @@ async function executePrepared(deps, prepare, expectedRequest, signal) {
|
|
|
4821
4827
|
}
|
|
4822
4828
|
const prepared = await prepare(signerAddress);
|
|
4823
4829
|
if (!prepared.ok) return prepared;
|
|
4824
|
-
if (
|
|
4830
|
+
if (await fingerprintPaymentIntent(prepared.value.request) !== await fingerprintPaymentIntent(expectedRequest)) return {
|
|
4825
4831
|
ok: false,
|
|
4826
4832
|
error: Errors.invalidInput("payment", "prepared command mismatch")
|
|
4827
4833
|
};
|
|
@@ -5045,12 +5051,6 @@ async function waitForPaymentSubmission(submission, signal, operation, onCancel
|
|
|
5045
5051
|
});
|
|
5046
5052
|
});
|
|
5047
5053
|
}
|
|
5048
|
-
/** Return one stable fingerprint for one JSON payment intent. */
|
|
5049
|
-
async function fingerprintPaymentIntent(intent) {
|
|
5050
|
-
const canonical = JSON.stringify(intent, (_key, value) => value !== null && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right))) : value);
|
|
5051
|
-
if (canonical === void 0) throw new TypeError("Payment intent must be JSON data");
|
|
5052
|
-
return keccak256(toBytes(canonical));
|
|
5053
|
-
}
|
|
5054
5054
|
function paymentExecutionIntent(input) {
|
|
5055
5055
|
if (actorReferenceToBackend(input.actor)?.kind === "org") return {
|
|
5056
5056
|
ok: false,
|
|
@@ -5614,7 +5614,7 @@ function mapOk(result, f) {
|
|
|
5614
5614
|
}
|
|
5615
5615
|
//#endregion
|
|
5616
5616
|
//#region package.json
|
|
5617
|
-
var version = "2.1.
|
|
5617
|
+
var version = "2.1.1";
|
|
5618
5618
|
//#endregion
|
|
5619
5619
|
//#region src/ports/auth-client.ts
|
|
5620
5620
|
var AuthClientError = class extends Data.TaggedError("AuthClientError") {};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as CapxulErrorDetails, A as CountryCode, D as AuthUserId, E as AuthSession, I as Money, Q as CapxulErrorCode, R as OrgId, W as RoleKey, X as toCountryCode, Y as toAddress, Z as CapxulError, a as AccountProvider, b as AccountId, c as Eip1193Provider, d as CapxulResult, f as Profile, i as injectedWalletSigner, l as eip1193AccountProvider, m as SmartAccount, n as CapxulSigner, nt as isCapxulError, o as AccountProviderSource, p as Session, r as Eip1193RequestProvider, s as AccountRequirement, t as CapxulDigestSigner, tt as FailureMode, u as localPrivateKeyAccountProvider, x as Address, y as Account } from "./signer-Bj4F-RwT.mjs";
|
|
2
|
-
import { $ as InboxMethods, $t as OrgLifecycle, A as OrganizationPaymentsMethods, At as PaymentDocumentRef, B as AccountMethods, Bt as RecipientResolution, C as ResendInviteTokenInput, Ct as OfframpQuoteInput, D as OrganizationPaymentBatchInput, Dt as Payment, E as RoleView, Et as PayeesMethods, F as PermissionOptions, Ft as PaymentStatus, G as ActorRequestIssueInput, Gt as TargetsMethods, H as ActorProfileMethods, Ht as Ref, I as PermissionReplaceInput, It as PaymentTiming, J as AddressBookEntry, Jt as AccountSetupStep, K as ActorRequestsMethods, Kt as fingerprintPaymentIntent, L as PermissionRevokeInput, Lt as PaymentType, M as PermissionChangeInput, Mt as PaymentDocumentVerification, N as PermissionCreateInput, Nt as PaymentDocumentsMethods, O as OrganizationPaymentInput, Ot as PaymentDirection, P as PermissionMethods, Pt as PaymentMoney, Q as InboxItem, Qt as AuthMethods, R as PermissionReadResult, Rt as PaymentsMethods, S as OrganizationAuditLogItem, St as OfframpQuote, T as RoleSpendCap, Tt as Payee, U as ActorRelationshipMethods, Ut as ResolvedTarget, V as ActorProfile, Vt as RecipientResolutionKind, W as ActorRequest, Wt as TargetReference, X as AddressBookMethods, Xt as IdentityMethods, Y as AddressBookLabelInput, Yt as isSettingUpLifecycle, Z as InboxApproveInput, Zt as SmartAccountMethods, _ as OrgMethods, _n as StateLabel, _t as FinancialOpsMethods, a as IdentityRuntimeSendResult, an as SubmittedPermissionExecution, at as ActivityPage, b as OrgView, bn as InvocationControls, bt as MeProfile, c as SystemHealth, ct as DepositInstructions, d as CurrentUserMethods, dn as CAPXUL_PAYMENTS_V2_ADDRESS, dt as DestinationKind, en as OrgSetupStep, et as ActivityAnnotationInput, f as CreateOrgInput, fn as Destination$1, ft as DestinationListInput, g as MemberView, gn as Readiness, gt as DestinationsMethods, h as MemberStatus, hn as OrgLane, ht as DestinationRemoveInput, i as IdentityRuntime, in as Permission, it as ActivityMethods, j as PermissionAssignInput, jt as PaymentDocumentRender, k as OrganizationPaymentItemInput, kt as PaymentDocumentKind, l as MediaMethods, lt as Destination, m as InviteMemberInput, mn as IdentityState, mt as DestinationRail, n as CreateCapxulClientInput, nn as CurrentHoldings, nt as ActivityItem, o as HoldingsMethods, on as CapxulEnv, ot as ActivityReference, p as DetectPendingOrgInvitationsResult, pn as IdentityEvent, pt as DestinationPayload, q as AddressBookAddInput, qt as AccountLifecycle, r as IdentityProfileDetails, rn as MovementAnnotation, rt as ActivityListParams, s as SystemMethods, st as ActorReference, t as CapxulClient, tn as WireObservationContext, tt as ActivityDetail, u as CurrentUserContext, un as TelemetryPort, ut as DestinationAddInput, v as OrgScopedMethods, vn as destination, vt as HandlesMethods, w as RoleDefinition, wt as OfframpStatus, x as OrganizationAccount, xt as OfframpMethods, y as OrgTemplate, yn as IdentityTransition, yt as MeMethods, z as AccountsMethods, zt as PaymentsPayInput } from "./create-capxul-client-
|
|
2
|
+
import { $ as InboxMethods, $t as OrgLifecycle, A as OrganizationPaymentsMethods, At as PaymentDocumentRef, B as AccountMethods, Bt as RecipientResolution, C as ResendInviteTokenInput, Ct as OfframpQuoteInput, D as OrganizationPaymentBatchInput, Dt as Payment, E as RoleView, Et as PayeesMethods, F as PermissionOptions, Ft as PaymentStatus, G as ActorRequestIssueInput, Gt as TargetsMethods, H as ActorProfileMethods, Ht as Ref, I as PermissionReplaceInput, It as PaymentTiming, J as AddressBookEntry, Jt as AccountSetupStep, K as ActorRequestsMethods, Kt as fingerprintPaymentIntent, L as PermissionRevokeInput, Lt as PaymentType, M as PermissionChangeInput, Mt as PaymentDocumentVerification, N as PermissionCreateInput, Nt as PaymentDocumentsMethods, O as OrganizationPaymentInput, Ot as PaymentDirection, P as PermissionMethods, Pt as PaymentMoney, Q as InboxItem, Qt as AuthMethods, R as PermissionReadResult, Rt as PaymentsMethods, S as OrganizationAuditLogItem, St as OfframpQuote, T as RoleSpendCap, Tt as Payee, U as ActorRelationshipMethods, Ut as ResolvedTarget, V as ActorProfile, Vt as RecipientResolutionKind, W as ActorRequest, Wt as TargetReference, X as AddressBookMethods, Xt as IdentityMethods, Y as AddressBookLabelInput, Yt as isSettingUpLifecycle, Z as InboxApproveInput, Zt as SmartAccountMethods, _ as OrgMethods, _n as StateLabel, _t as FinancialOpsMethods, a as IdentityRuntimeSendResult, an as SubmittedPermissionExecution, at as ActivityPage, b as OrgView, bn as InvocationControls, bt as MeProfile, c as SystemHealth, ct as DepositInstructions, d as CurrentUserMethods, dn as CAPXUL_PAYMENTS_V2_ADDRESS, dt as DestinationKind, en as OrgSetupStep, et as ActivityAnnotationInput, f as CreateOrgInput, fn as Destination$1, ft as DestinationListInput, g as MemberView, gn as Readiness, gt as DestinationsMethods, h as MemberStatus, hn as OrgLane, ht as DestinationRemoveInput, i as IdentityRuntime, in as Permission, it as ActivityMethods, j as PermissionAssignInput, jt as PaymentDocumentRender, k as OrganizationPaymentItemInput, kt as PaymentDocumentKind, l as MediaMethods, lt as Destination, m as InviteMemberInput, mn as IdentityState, mt as DestinationRail, n as CreateCapxulClientInput, nn as CurrentHoldings, nt as ActivityItem, o as HoldingsMethods, on as CapxulEnv, ot as ActivityReference, p as DetectPendingOrgInvitationsResult, pn as IdentityEvent, pt as DestinationPayload, q as AddressBookAddInput, qt as AccountLifecycle, r as IdentityProfileDetails, rn as MovementAnnotation, rt as ActivityListParams, s as SystemMethods, st as ActorReference, t as CapxulClient, tn as WireObservationContext, tt as ActivityDetail, u as CurrentUserContext, un as TelemetryPort, ut as DestinationAddInput, v as OrgScopedMethods, vn as destination, vt as HandlesMethods, w as RoleDefinition, wt as OfframpStatus, x as OrganizationAccount, xt as OfframpMethods, y as OrgTemplate, yn as IdentityTransition, yt as MeMethods, z as AccountsMethods, zt as PaymentsPayInput } from "./create-capxul-client-BI-6Za6X.mjs";
|
|
3
3
|
import { Hex } from "viem";
|
|
4
4
|
import { Context, Effect, Layer } from "effect";
|
|
5
5
|
import { FunctionReference } from "convex/server";
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as OBSERVATION_CONTEXT_HEADER, B as captureException, C as bootstrapErrorFromCapxul, D as fingerprintPaymentIntent, E as version, F as EngineeringTelemetryBootstrapPolicy, H as CAPXUL_PAYMENTS_V2_ADDRESS, I as isSettingUpLifecycle, K as destination, L as formatTraceparent, M as sanitizeObservationContext, N as CAPXUL_FUNCTIONS, O as toWei, P as BootstrapEnvelope, R as copyInvocationObservation, S as BootstrapPortTag, T as AuthClientPortTag, U as normalizeBindingEmail, V as captureExceptionSync, W as BASE_SEPOLIA_CHAIN_ID, _ as identityErrorFromCapxul, a as observeFailedResult, b as ClockError, c as PostHogTelemetryLayer, d as SmartAccountPortTag, f as smartAccountErrorFromCapxul, g as IdentityPortTag, h as wireChainId, i as observationContextProps, j as encodeObservationContextHeader, k as fromWei, l as TelemetryPortTag, m as accountReadErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as AccountReadPortTag, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as detectAuthCacheAdapter, t as assembleCapxulClient, v as ConvexCallPortTag, w as authClientPortFromPromiseAdapter, x as ClockPortTag, y as convexCallErrorFromCapxul, z as readInvocationObservation } from "./create-capxul-client-
|
|
1
|
+
import { A as OBSERVATION_CONTEXT_HEADER, B as captureException, C as bootstrapErrorFromCapxul, D as fingerprintPaymentIntent, E as version, F as EngineeringTelemetryBootstrapPolicy, H as CAPXUL_PAYMENTS_V2_ADDRESS, I as isSettingUpLifecycle, K as destination, L as formatTraceparent, M as sanitizeObservationContext, N as CAPXUL_FUNCTIONS, O as toWei, P as BootstrapEnvelope, R as copyInvocationObservation, S as BootstrapPortTag, T as AuthClientPortTag, U as normalizeBindingEmail, V as captureExceptionSync, W as BASE_SEPOLIA_CHAIN_ID, _ as identityErrorFromCapxul, a as observeFailedResult, b as ClockError, c as PostHogTelemetryLayer, d as SmartAccountPortTag, f as smartAccountErrorFromCapxul, g as IdentityPortTag, h as wireChainId, i as observationContextProps, j as encodeObservationContextHeader, k as fromWei, l as TelemetryPortTag, m as accountReadErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as AccountReadPortTag, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as detectAuthCacheAdapter, t as assembleCapxulClient, v as ConvexCallPortTag, w as authClientPortFromPromiseAdapter, x as ClockPortTag, y as convexCallErrorFromCapxul, z as readInvocationObservation } from "./create-capxul-client-CPhTPz_9.mjs";
|
|
2
2
|
import { A as toSessionToken, C as toEpochMs, D as toOrgId, E as toKycTier, F as isCapxulError, M as CapxulError, O as toPublishableKey, P as Errors, S as toEmail, T as toJwtToken, _ as toAuthUserId, b as toCurrencyCode, h as toAllowedOrigin, j as decodeConvexError, k as toRoleKey, m as toAddress, o as AuthCachePortTag, p as toAccountId, v as toChainId, w as toEpochSeconds, x as toDurationMs, y as toCountryCode } from "./InMemoryAuthCacheAdapter-Rc8tCtml.mjs";
|
|
3
3
|
import { keccak256, recoverAddress, stringToHex } from "viem";
|
|
4
4
|
import { Cause, Context, Data, Effect, Exit, Layer, Result, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as TelemetryGroupInput, ln as TelemetryIdentifyInput, sn as TelemetryEvent, t as CapxulClient, yn as IdentityTransition } from "../create-capxul-client-
|
|
1
|
+
import { cn as TelemetryGroupInput, ln as TelemetryIdentifyInput, sn as TelemetryEvent, t as CapxulClient, yn as IdentityTransition } from "../create-capxul-client-BI-6Za6X.mjs";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as bootstrapErrorFromCapxul, G as deriveCapxulSafeAddress, O as toWei, _ as identityErrorFromCapxul, f as smartAccountErrorFromCapxul, h as wireChainId, k as fromWei, m as accountReadErrorFromCapxul, t as assembleCapxulClient, u as redactTelemetryEvent, w as authClientPortFromPromiseAdapter, y as convexCallErrorFromCapxul } from "../create-capxul-client-
|
|
1
|
+
import { C as bootstrapErrorFromCapxul, G as deriveCapxulSafeAddress, O as toWei, _ as identityErrorFromCapxul, f as smartAccountErrorFromCapxul, h as wireChainId, k as fromWei, m as accountReadErrorFromCapxul, t as assembleCapxulClient, u as redactTelemetryEvent, w as authClientPortFromPromiseAdapter, y as convexCallErrorFromCapxul } from "../create-capxul-client-CPhTPz_9.mjs";
|
|
2
2
|
import { A as toSessionToken, C as toEpochMs, E as toKycTier, M as CapxulError, O as toPublishableKey, P as Errors, S as toEmail, T as toJwtToken, _ as toAuthUserId, g as toAppId, h as toAllowedOrigin, m as toAddress, p as toAccountId, t as InMemoryAuthCacheAdapter, v as toChainId, w as toEpochSeconds, x as toDurationMs, y as toCountryCode } from "../InMemoryAuthCacheAdapter-Rc8tCtml.mjs";
|
|
3
3
|
import { keccak256 } from "viem";
|
|
4
4
|
import { Effect, Result, Semaphore } from "effect";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Xelmar-tech/infrastructure.git",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
47
47
|
"vite-plus": "0.1.23",
|
|
48
48
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23",
|
|
49
|
-
"@capxul/config": "0.
|
|
49
|
+
"@capxul/config": "0.2.0",
|
|
50
50
|
"@capxul/errors": "0.0.1",
|
|
51
|
+
"@capxul/observability": "2.1.1",
|
|
51
52
|
"@capxul/typescript-config": "0.0.0",
|
|
52
53
|
"@capxul/types": "0.1.0",
|
|
53
|
-
"@capxul/wire": "0.
|
|
54
|
-
"@capxul/observability": "2.1.0"
|
|
54
|
+
"@capxul/wire": "0.3.0"
|
|
55
55
|
},
|
|
56
56
|
"_permissionlessPinReason": "permissionless.toSafeSmartAccount is pinned to 0.3.4 for live Safe deployment E2E. Counterfactual address fixtures captured 2026-05-17 in packages/backend/convex/_shared/__tests__/counterfactual.test.ts and packages/config/tests/safe.test.ts must be re-verified before upgrading.",
|
|
57
57
|
"scripts": {
|