@coinbase/cdp-sdk 1.23.0 → 1.25.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/CHANGELOG.md +18 -0
- package/README.md +2 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/getUserOperation.js +2 -1
- package/_cjs/actions/evm/getUserOperation.js.map +1 -1
- package/_cjs/client/evm/evm.js +22 -0
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/solana/solana.js +39 -0
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +25 -2
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +20 -0
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +5 -4
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +76 -0
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-token-balances/solana-token-balances.js +15 -0
- package/_cjs/openapi-client/generated/solana-token-balances/solana-token-balances.js.map +1 -0
- package/_cjs/openapi-client/generated/solana-token-balances/solana-token-balances.msw.js +43 -0
- package/_cjs/openapi-client/generated/solana-token-balances/solana-token-balances.msw.js.map +1 -0
- package/_cjs/openapi-client/index.js +3 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/policies/schema.js +68 -1
- package/_cjs/policies/schema.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/getUserOperation.js +2 -1
- package/_esm/actions/evm/getUserOperation.js.map +1 -1
- package/_esm/client/evm/evm.js +22 -0
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/solana/solana.js +39 -0
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +23 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +20 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +5 -4
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +76 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_esm/openapi-client/generated/solana-token-balances/solana-token-balances.js +11 -0
- package/_esm/openapi-client/generated/solana-token-balances/solana-token-balances.js.map +1 -0
- package/_esm/openapi-client/generated/solana-token-balances/solana-token-balances.msw.js +37 -0
- package/_esm/openapi-client/generated/solana-token-balances/solana-token-balances.msw.js.map +1 -0
- package/_esm/openapi-client/index.js +3 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/policies/schema.js +67 -0
- package/_esm/policies/schema.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +2 -0
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +14 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +18 -4
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +19 -1
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +51 -2
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +118 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +5 -4
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-token-balances/solana-token-balances.d.ts +20 -0
- package/_types/openapi-client/generated/solana-token-balances/solana-token-balances.d.ts.map +1 -0
- package/_types/openapi-client/generated/solana-token-balances/solana-token-balances.msw.d.ts +6 -0
- package/_types/openapi-client/generated/solana-token-balances/solana-token-balances.msw.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +2 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/schema.d.ts +6604 -2230
- package/_types/policies/schema.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmSmartAccount.ts +1 -0
- package/accounts/evm/types.ts +2 -0
- package/actions/evm/getUserOperation.ts +4 -1
- package/client/evm/evm.ts +31 -0
- package/client/evm/evm.types.ts +20 -4
- package/client/solana/solana.ts +47 -0
- package/client/solana/solana.types.ts +60 -1
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +159 -1
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +40 -0
- package/openapi-client/generated/index.msw.ts +5 -4
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +116 -0
- package/openapi-client/generated/solana-token-balances/solana-token-balances.msw.ts +55 -0
- package/openapi-client/generated/solana-token-balances/solana-token-balances.ts +37 -0
- package/openapi-client/index.ts +3 -0
- package/package.json +1 -1
- package/policies/schema.ts +87 -0
- package/version.ts +1 -1
|
@@ -27,6 +27,14 @@ export const getListEvmSmartAccountsResponseMock = (): ListEvmSmartAccounts200 =
|
|
|
27
27
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
28
28
|
undefined,
|
|
29
29
|
]),
|
|
30
|
+
policies: faker.helpers.arrayElement([
|
|
31
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
32
|
+
faker.helpers.fromRegExp(
|
|
33
|
+
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
undefined,
|
|
37
|
+
]),
|
|
30
38
|
createdAt: faker.helpers.arrayElement([
|
|
31
39
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
32
40
|
undefined,
|
|
@@ -52,6 +60,14 @@ export const getCreateEvmSmartAccountResponseMock = (
|
|
|
52
60
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
53
61
|
undefined,
|
|
54
62
|
]),
|
|
63
|
+
policies: faker.helpers.arrayElement([
|
|
64
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
65
|
+
faker.helpers.fromRegExp(
|
|
66
|
+
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
undefined,
|
|
70
|
+
]),
|
|
55
71
|
createdAt: faker.helpers.arrayElement([
|
|
56
72
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
57
73
|
undefined,
|
|
@@ -74,6 +90,14 @@ export const getGetEvmSmartAccountByNameResponseMock = (
|
|
|
74
90
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
75
91
|
undefined,
|
|
76
92
|
]),
|
|
93
|
+
policies: faker.helpers.arrayElement([
|
|
94
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
95
|
+
faker.helpers.fromRegExp(
|
|
96
|
+
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
undefined,
|
|
100
|
+
]),
|
|
77
101
|
createdAt: faker.helpers.arrayElement([
|
|
78
102
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
79
103
|
undefined,
|
|
@@ -96,6 +120,14 @@ export const getGetEvmSmartAccountResponseMock = (
|
|
|
96
120
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
97
121
|
undefined,
|
|
98
122
|
]),
|
|
123
|
+
policies: faker.helpers.arrayElement([
|
|
124
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
125
|
+
faker.helpers.fromRegExp(
|
|
126
|
+
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
undefined,
|
|
130
|
+
]),
|
|
99
131
|
createdAt: faker.helpers.arrayElement([
|
|
100
132
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
101
133
|
undefined,
|
|
@@ -118,6 +150,14 @@ export const getUpdateEvmSmartAccountResponseMock = (
|
|
|
118
150
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
119
151
|
undefined,
|
|
120
152
|
]),
|
|
153
|
+
policies: faker.helpers.arrayElement([
|
|
154
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
155
|
+
faker.helpers.fromRegExp(
|
|
156
|
+
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
|
157
|
+
),
|
|
158
|
+
),
|
|
159
|
+
undefined,
|
|
160
|
+
]),
|
|
121
161
|
createdAt: faker.helpers.arrayElement([
|
|
122
162
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
123
163
|
undefined,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
2
|
+
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
1
3
|
export * from "./evm-swaps/evm-swaps.msw.js";
|
|
2
|
-
export * from "./faucets/faucets.msw.js";
|
|
3
4
|
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
5
|
+
export * from "./faucets/faucets.msw.js";
|
|
6
|
+
export * from "./payments-alpha/payments-alpha.msw.js";
|
|
4
7
|
export * from "./policy-engine/policy-engine.msw.js";
|
|
5
|
-
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
6
|
-
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
7
8
|
export * from "./solana-accounts/solana-accounts.msw.js";
|
|
8
|
-
export * from "./
|
|
9
|
+
export * from "./solana-token-balances/solana-token-balances.msw.js";
|
|
@@ -348,6 +348,35 @@ export const getListPoliciesResponseMock = (): ListPolicies200 => ({
|
|
|
348
348
|
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
349
349
|
operation: faker.helpers.arrayElement(["signEvmHash"] as const),
|
|
350
350
|
},
|
|
351
|
+
{
|
|
352
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
353
|
+
operation: faker.helpers.arrayElement(["prepareUserOperation"] as const),
|
|
354
|
+
criteria: Array.from(
|
|
355
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
356
|
+
(_, i) => i + 1,
|
|
357
|
+
).map(() =>
|
|
358
|
+
faker.helpers.arrayElement([
|
|
359
|
+
{ ...getListPoliciesResponseEthValueCriterionMock() },
|
|
360
|
+
{ ...getListPoliciesResponseEvmAddressCriterionMock() },
|
|
361
|
+
{ ...getListPoliciesResponseEvmNetworkCriterionMock() },
|
|
362
|
+
{ ...getListPoliciesResponseEvmDataCriterionMock() },
|
|
363
|
+
]),
|
|
364
|
+
),
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
368
|
+
operation: faker.helpers.arrayElement(["sendUserOperation"] as const),
|
|
369
|
+
criteria: Array.from(
|
|
370
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
371
|
+
(_, i) => i + 1,
|
|
372
|
+
).map(() =>
|
|
373
|
+
faker.helpers.arrayElement([
|
|
374
|
+
{ ...getListPoliciesResponseEthValueCriterionMock() },
|
|
375
|
+
{ ...getListPoliciesResponseEvmAddressCriterionMock() },
|
|
376
|
+
{ ...getListPoliciesResponseEvmDataCriterionMock() },
|
|
377
|
+
]),
|
|
378
|
+
),
|
|
379
|
+
},
|
|
351
380
|
]),
|
|
352
381
|
),
|
|
353
382
|
createdAt: faker.string.alpha(20),
|
|
@@ -668,6 +697,35 @@ export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> =
|
|
|
668
697
|
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
669
698
|
operation: faker.helpers.arrayElement(["signEvmHash"] as const),
|
|
670
699
|
},
|
|
700
|
+
{
|
|
701
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
702
|
+
operation: faker.helpers.arrayElement(["prepareUserOperation"] as const),
|
|
703
|
+
criteria: Array.from(
|
|
704
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
705
|
+
(_, i) => i + 1,
|
|
706
|
+
).map(() =>
|
|
707
|
+
faker.helpers.arrayElement([
|
|
708
|
+
{ ...getCreatePolicyResponseEthValueCriterionMock() },
|
|
709
|
+
{ ...getCreatePolicyResponseEvmAddressCriterionMock() },
|
|
710
|
+
{ ...getCreatePolicyResponseEvmNetworkCriterionMock() },
|
|
711
|
+
{ ...getCreatePolicyResponseEvmDataCriterionMock() },
|
|
712
|
+
]),
|
|
713
|
+
),
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
717
|
+
operation: faker.helpers.arrayElement(["sendUserOperation"] as const),
|
|
718
|
+
criteria: Array.from(
|
|
719
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
720
|
+
(_, i) => i + 1,
|
|
721
|
+
).map(() =>
|
|
722
|
+
faker.helpers.arrayElement([
|
|
723
|
+
{ ...getCreatePolicyResponseEthValueCriterionMock() },
|
|
724
|
+
{ ...getCreatePolicyResponseEvmAddressCriterionMock() },
|
|
725
|
+
{ ...getCreatePolicyResponseEvmDataCriterionMock() },
|
|
726
|
+
]),
|
|
727
|
+
),
|
|
728
|
+
},
|
|
671
729
|
]),
|
|
672
730
|
),
|
|
673
731
|
createdAt: faker.string.alpha(20),
|
|
@@ -985,6 +1043,35 @@ export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> =
|
|
|
985
1043
|
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
986
1044
|
operation: faker.helpers.arrayElement(["signEvmHash"] as const),
|
|
987
1045
|
},
|
|
1046
|
+
{
|
|
1047
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
1048
|
+
operation: faker.helpers.arrayElement(["prepareUserOperation"] as const),
|
|
1049
|
+
criteria: Array.from(
|
|
1050
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
1051
|
+
(_, i) => i + 1,
|
|
1052
|
+
).map(() =>
|
|
1053
|
+
faker.helpers.arrayElement([
|
|
1054
|
+
{ ...getGetPolicyByIdResponseEthValueCriterionMock() },
|
|
1055
|
+
{ ...getGetPolicyByIdResponseEvmAddressCriterionMock() },
|
|
1056
|
+
{ ...getGetPolicyByIdResponseEvmNetworkCriterionMock() },
|
|
1057
|
+
{ ...getGetPolicyByIdResponseEvmDataCriterionMock() },
|
|
1058
|
+
]),
|
|
1059
|
+
),
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
1063
|
+
operation: faker.helpers.arrayElement(["sendUserOperation"] as const),
|
|
1064
|
+
criteria: Array.from(
|
|
1065
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
1066
|
+
(_, i) => i + 1,
|
|
1067
|
+
).map(() =>
|
|
1068
|
+
faker.helpers.arrayElement([
|
|
1069
|
+
{ ...getGetPolicyByIdResponseEthValueCriterionMock() },
|
|
1070
|
+
{ ...getGetPolicyByIdResponseEvmAddressCriterionMock() },
|
|
1071
|
+
{ ...getGetPolicyByIdResponseEvmDataCriterionMock() },
|
|
1072
|
+
]),
|
|
1073
|
+
),
|
|
1074
|
+
},
|
|
988
1075
|
]),
|
|
989
1076
|
),
|
|
990
1077
|
createdAt: faker.string.alpha(20),
|
|
@@ -1302,6 +1389,35 @@ export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> =
|
|
|
1302
1389
|
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
1303
1390
|
operation: faker.helpers.arrayElement(["signEvmHash"] as const),
|
|
1304
1391
|
},
|
|
1392
|
+
{
|
|
1393
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
1394
|
+
operation: faker.helpers.arrayElement(["prepareUserOperation"] as const),
|
|
1395
|
+
criteria: Array.from(
|
|
1396
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
1397
|
+
(_, i) => i + 1,
|
|
1398
|
+
).map(() =>
|
|
1399
|
+
faker.helpers.arrayElement([
|
|
1400
|
+
{ ...getUpdatePolicyResponseEthValueCriterionMock() },
|
|
1401
|
+
{ ...getUpdatePolicyResponseEvmAddressCriterionMock() },
|
|
1402
|
+
{ ...getUpdatePolicyResponseEvmNetworkCriterionMock() },
|
|
1403
|
+
{ ...getUpdatePolicyResponseEvmDataCriterionMock() },
|
|
1404
|
+
]),
|
|
1405
|
+
),
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
action: faker.helpers.arrayElement(["reject", "accept"] as const),
|
|
1409
|
+
operation: faker.helpers.arrayElement(["sendUserOperation"] as const),
|
|
1410
|
+
criteria: Array.from(
|
|
1411
|
+
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
1412
|
+
(_, i) => i + 1,
|
|
1413
|
+
).map(() =>
|
|
1414
|
+
faker.helpers.arrayElement([
|
|
1415
|
+
{ ...getUpdatePolicyResponseEthValueCriterionMock() },
|
|
1416
|
+
{ ...getUpdatePolicyResponseEvmAddressCriterionMock() },
|
|
1417
|
+
{ ...getUpdatePolicyResponseEvmDataCriterionMock() },
|
|
1418
|
+
]),
|
|
1419
|
+
),
|
|
1420
|
+
},
|
|
1305
1421
|
]),
|
|
1306
1422
|
),
|
|
1307
1423
|
createdAt: faker.string.alpha(20),
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import { faker } from "@faker-js/faker";
|
|
9
|
+
|
|
10
|
+
import { HttpResponse, delay, http } from "msw";
|
|
11
|
+
|
|
12
|
+
import type { ListSolanaTokenBalances200 } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
13
|
+
|
|
14
|
+
export const getListSolanaTokenBalancesResponseMock = (): ListSolanaTokenBalances200 => ({
|
|
15
|
+
...{
|
|
16
|
+
balances: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
|
|
17
|
+
() => ({
|
|
18
|
+
amount: {
|
|
19
|
+
amount: faker.helpers.fromRegExp("^[0-9]+$"),
|
|
20
|
+
decimals: faker.number.int({ min: undefined, max: undefined }),
|
|
21
|
+
},
|
|
22
|
+
token: {
|
|
23
|
+
symbol: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
24
|
+
name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
25
|
+
mintAddress: faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const getListSolanaTokenBalancesMockHandler = (
|
|
34
|
+
overrideResponse?:
|
|
35
|
+
| ListSolanaTokenBalances200
|
|
36
|
+
| ((
|
|
37
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
38
|
+
) => Promise<ListSolanaTokenBalances200> | ListSolanaTokenBalances200),
|
|
39
|
+
) => {
|
|
40
|
+
return http.get("*/v2/solana/token-balances/:network/:address", async info => {
|
|
41
|
+
await delay(0);
|
|
42
|
+
|
|
43
|
+
return new HttpResponse(
|
|
44
|
+
JSON.stringify(
|
|
45
|
+
overrideResponse !== undefined
|
|
46
|
+
? typeof overrideResponse === "function"
|
|
47
|
+
? await overrideResponse(info)
|
|
48
|
+
: overrideResponse
|
|
49
|
+
: getListSolanaTokenBalancesResponseMock(),
|
|
50
|
+
),
|
|
51
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export const getSolanaTokenBalancesMock = () => [getListSolanaTokenBalancesMockHandler()];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
ListSolanaTokenBalances200,
|
|
10
|
+
ListSolanaTokenBalancesNetwork,
|
|
11
|
+
ListSolanaTokenBalancesParams,
|
|
12
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
13
|
+
|
|
14
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
15
|
+
|
|
16
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Lists the token balances of a Solana address on a given network. The balances include SPL tokens and the native SOL token. The response is paginated, and by default, returns 20 balances per page.
|
|
20
|
+
|
|
21
|
+
**Note:** This endpoint is still under development and does not yet provide strong availability or freshness guarantees. Freshness and availability of new token balances will improve over the coming weeks.
|
|
22
|
+
* @summary List Solana token balances
|
|
23
|
+
*/
|
|
24
|
+
export const listSolanaTokenBalances = (
|
|
25
|
+
network: ListSolanaTokenBalancesNetwork,
|
|
26
|
+
address: string,
|
|
27
|
+
params?: ListSolanaTokenBalancesParams,
|
|
28
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
29
|
+
) => {
|
|
30
|
+
return cdpApiClient<ListSolanaTokenBalances200>(
|
|
31
|
+
{ url: `/v2/solana/token-balances/${network}/${address}`, method: "GET", params },
|
|
32
|
+
options,
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
export type ListSolanaTokenBalancesResult = NonNullable<
|
|
36
|
+
Awaited<ReturnType<typeof listSolanaTokenBalances>>
|
|
37
|
+
>;
|
package/openapi-client/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./generated/evm-smart-accounts/evm-smart-accounts.js";
|
|
|
4
4
|
export * from "./generated/evm-swaps/evm-swaps.js";
|
|
5
5
|
export * from "./generated/evm-token-balances/evm-token-balances.js";
|
|
6
6
|
export * from "./generated/solana-accounts/solana-accounts.js";
|
|
7
|
+
export * from "./generated/solana-token-balances/solana-token-balances.js";
|
|
7
8
|
export * from "./generated/faucets/faucets.js";
|
|
8
9
|
export * from "./generated/policy-engine/policy-engine.js";
|
|
9
10
|
export * from "./generated/payments-alpha/payments-alpha.js";
|
|
@@ -17,6 +18,7 @@ import * as faucets from "./generated/faucets/faucets.js";
|
|
|
17
18
|
import * as payments from "./generated/payments-alpha/payments-alpha.js";
|
|
18
19
|
import * as policies from "./generated/policy-engine/policy-engine.js";
|
|
19
20
|
import * as solana from "./generated/solana-accounts/solana-accounts.js";
|
|
21
|
+
import * as solanaTokenBalances from "./generated/solana-token-balances/solana-token-balances.js";
|
|
20
22
|
|
|
21
23
|
export const CdpOpenApiClient = {
|
|
22
24
|
...evm,
|
|
@@ -24,6 +26,7 @@ export const CdpOpenApiClient = {
|
|
|
24
26
|
...evmSwaps,
|
|
25
27
|
...evmTokenBalances,
|
|
26
28
|
...solana,
|
|
29
|
+
...solanaTokenBalances,
|
|
27
30
|
...faucets,
|
|
28
31
|
...policies,
|
|
29
32
|
...payments,
|
package/package.json
CHANGED
package/policies/schema.ts
CHANGED
|
@@ -434,6 +434,45 @@ export const SignSolTransactionCriteriaSchema = z
|
|
|
434
434
|
*/
|
|
435
435
|
export type SignSolTransactionCriteria = z.infer<typeof SignSolTransactionCriteriaSchema>;
|
|
436
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Schema for criteria used in PrepareUserOperation operations
|
|
439
|
+
*/
|
|
440
|
+
export const PrepareUserOperationCriteriaSchema = z
|
|
441
|
+
.array(
|
|
442
|
+
z.discriminatedUnion("type", [
|
|
443
|
+
EthValueCriterionSchema,
|
|
444
|
+
EvmAddressCriterionSchema,
|
|
445
|
+
EvmNetworkCriterionSchema,
|
|
446
|
+
EvmDataCriterionSchema,
|
|
447
|
+
]),
|
|
448
|
+
)
|
|
449
|
+
.max(10)
|
|
450
|
+
.min(1);
|
|
451
|
+
/**
|
|
452
|
+
* Type representing a set of criteria for the prepareUserOperation operation.
|
|
453
|
+
* Can contain up to 10 individual criterion objects of ETH value, EVM address, EVM network, or EVM data types.
|
|
454
|
+
*/
|
|
455
|
+
export type PrepareUserOperationCriteria = z.infer<typeof PrepareUserOperationCriteriaSchema>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Schema for criteria used in SendUserOperation operations
|
|
459
|
+
*/
|
|
460
|
+
export const SendUserOperationCriteriaSchema = z
|
|
461
|
+
.array(
|
|
462
|
+
z.discriminatedUnion("type", [
|
|
463
|
+
EthValueCriterionSchema,
|
|
464
|
+
EvmAddressCriterionSchema,
|
|
465
|
+
EvmDataCriterionSchema,
|
|
466
|
+
]),
|
|
467
|
+
)
|
|
468
|
+
.max(10)
|
|
469
|
+
.min(1);
|
|
470
|
+
/**
|
|
471
|
+
* Type representing a set of criteria for the sendUserOperation operation.
|
|
472
|
+
* Can contain up to 10 individual criterion objects of ETH value, EVM address, or EVM data types.
|
|
473
|
+
*/
|
|
474
|
+
export type SendUserOperationCriteria = z.infer<typeof SendUserOperationCriteriaSchema>;
|
|
475
|
+
|
|
437
476
|
/**
|
|
438
477
|
* Enum for Solana Operation types
|
|
439
478
|
*/
|
|
@@ -597,6 +636,52 @@ export const SignSolTransactionRuleSchema = z.object({
|
|
|
597
636
|
});
|
|
598
637
|
export type SignSolTransactionRule = z.infer<typeof SignSolTransactionRuleSchema>;
|
|
599
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Type representing a 'prepareUserOperation' policy rule that can accept or reject specific operations
|
|
641
|
+
* based on a set of criteria.
|
|
642
|
+
*/
|
|
643
|
+
export const PrepareUserOperationRuleSchema = z.object({
|
|
644
|
+
/**
|
|
645
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
646
|
+
* "accept" will allow the operation, "reject" will block it.
|
|
647
|
+
*/
|
|
648
|
+
action: ActionEnum,
|
|
649
|
+
/**
|
|
650
|
+
* The operation to which this rule applies.
|
|
651
|
+
* Must be "prepareUserOperation".
|
|
652
|
+
*/
|
|
653
|
+
operation: z.literal("prepareUserOperation"),
|
|
654
|
+
/**
|
|
655
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
656
|
+
* Must be compatible with the specified operation type.
|
|
657
|
+
*/
|
|
658
|
+
criteria: PrepareUserOperationCriteriaSchema,
|
|
659
|
+
});
|
|
660
|
+
export type PrepareUserOperationRule = z.infer<typeof PrepareUserOperationRuleSchema>;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Type representing a 'sendUserOperation' policy rule that can accept or reject specific operations
|
|
664
|
+
* based on a set of criteria.
|
|
665
|
+
*/
|
|
666
|
+
export const SendUserOperationRuleSchema = z.object({
|
|
667
|
+
/**
|
|
668
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
669
|
+
* "accept" will allow the operation, "reject" will block it.
|
|
670
|
+
*/
|
|
671
|
+
action: ActionEnum,
|
|
672
|
+
/**
|
|
673
|
+
* The operation to which this rule applies.
|
|
674
|
+
* Must be "sendUserOperation".
|
|
675
|
+
*/
|
|
676
|
+
operation: z.literal("sendUserOperation"),
|
|
677
|
+
/**
|
|
678
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
679
|
+
* Must be compatible with the specified operation type.
|
|
680
|
+
*/
|
|
681
|
+
criteria: SendUserOperationCriteriaSchema,
|
|
682
|
+
});
|
|
683
|
+
export type SendUserOperationRule = z.infer<typeof SendUserOperationRuleSchema>;
|
|
684
|
+
|
|
600
685
|
/**
|
|
601
686
|
* Schema for policy rules
|
|
602
687
|
*/
|
|
@@ -607,6 +692,8 @@ export const RuleSchema = z.discriminatedUnion("operation", [
|
|
|
607
692
|
SignEvmTypedDataRuleSchema,
|
|
608
693
|
SendEvmTransactionRuleSchema,
|
|
609
694
|
SignSolTransactionRuleSchema,
|
|
695
|
+
PrepareUserOperationRuleSchema,
|
|
696
|
+
SendUserOperationRuleSchema,
|
|
610
697
|
]);
|
|
611
698
|
|
|
612
699
|
/**
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.25.0";
|