@coinbase/cdp-sdk 0.0.0 → 1.0.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/README.md +165 -0
- package/dist/accounts/evm/toEvmServerAccount.d.ts +19 -0
- package/dist/accounts/evm/toEvmServerAccount.js +42 -0
- package/dist/accounts/evm/toEvmSmartAccount.d.ts +24 -0
- package/dist/accounts/evm/toEvmSmartAccount.js +24 -0
- package/dist/accounts/types.d.ts +45 -0
- package/dist/accounts/types.js +2 -0
- package/dist/actions/evm/sendUserOperation.d.ts +95 -0
- package/dist/actions/evm/sendUserOperation.js +87 -0
- package/dist/actions/evm/waitForUserOperation.d.ts +63 -0
- package/dist/actions/evm/waitForUserOperation.js +60 -0
- package/dist/analytics.d.ts +30 -0
- package/dist/analytics.js +89 -0
- package/dist/auth/errors.d.ts +45 -0
- package/dist/auth/errors.js +62 -0
- package/dist/auth/hooks/axios/index.d.ts +1 -0
- package/dist/auth/hooks/axios/index.js +17 -0
- package/dist/auth/hooks/axios/withAuth.d.ts +37 -0
- package/dist/auth/hooks/axios/withAuth.js +73 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +43 -0
- package/dist/auth/utils/http.d.ts +60 -0
- package/dist/auth/utils/http.js +72 -0
- package/dist/auth/utils/index.d.ts +2 -0
- package/dist/auth/utils/index.js +18 -0
- package/dist/auth/utils/jwt.d.ts +88 -0
- package/dist/auth/utils/jwt.js +235 -0
- package/dist/client/cdp.d.ts +43 -0
- package/dist/client/cdp.js +40 -0
- package/dist/client/evm/evm.d.ts +387 -0
- package/dist/client/evm/evm.js +520 -0
- package/dist/client/evm/evm.types.d.ts +254 -0
- package/dist/client/evm/evm.types.js +2 -0
- package/dist/client/evm/index.d.ts +1 -0
- package/dist/client/evm/index.js +5 -0
- package/dist/client/solana/index.d.ts +1 -0
- package/dist/client/solana/index.js +5 -0
- package/dist/client/solana/solana.d.ts +168 -0
- package/dist/client/solana/solana.js +207 -0
- package/dist/client/solana/solana.types.d.ts +94 -0
- package/dist/client/solana/solana.types.js +2 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +7 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.js +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/openapi-client/cdpApiClient.d.ts +50 -0
- package/dist/openapi-client/cdpApiClient.js +146 -0
- package/dist/openapi-client/errors.d.ts +53 -0
- package/dist/openapi-client/errors.js +70 -0
- package/dist/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +345 -0
- package/dist/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +54 -0
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.d.ts +62 -0
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.js +85 -0
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +17 -0
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.msw.js +113 -0
- package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +48 -0
- package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +66 -0
- package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +15 -0
- package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +99 -0
- package/dist/openapi-client/generated/faucets/faucets.d.ts +48 -0
- package/dist/openapi-client/generated/faucets/faucets.js +51 -0
- package/dist/openapi-client/generated/faucets/faucets.msw.d.ts +7 -0
- package/dist/openapi-client/generated/faucets/faucets.msw.js +43 -0
- package/dist/openapi-client/generated/index.msw.d.ts +4 -0
- package/dist/openapi-client/generated/index.msw.js +20 -0
- package/dist/openapi-client/generated/solana-accounts/solana-accounts.d.ts +61 -0
- package/dist/openapi-client/generated/solana-accounts/solana-accounts.js +79 -0
- package/dist/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +15 -0
- package/dist/openapi-client/generated/solana-accounts/solana-accounts.msw.js +99 -0
- package/dist/openapi-client/index.d.ts +55 -0
- package/dist/openapi-client/index.js +65 -0
- package/dist/types/calls.d.ts +13 -0
- package/dist/types/calls.js +4 -0
- package/dist/types/contract.d.ts +30 -0
- package/dist/types/contract.js +4 -0
- package/dist/types/misc.d.ts +3 -0
- package/dist/types/misc.js +3 -0
- package/dist/types/multicall.d.ts +9 -0
- package/dist/types/multicall.js +2 -0
- package/dist/types/utils.d.ts +196 -0
- package/dist/types/utils.js +4 -0
- package/dist/utils/wait.d.ts +28 -0
- package/dist/utils/wait.js +34 -0
- package/package.json +72 -5
- package/index.js +0 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEvmAccountsMock = exports.getSignEvmMessageMockHandler = exports.getSignEvmHashMockHandler = exports.getSignEvmTransactionMockHandler = exports.getGetEvmAccountByNameMockHandler = exports.getGetEvmAccountMockHandler = exports.getCreateEvmAccountMockHandler = exports.getListEvmAccountsMockHandler = exports.getSignEvmMessageResponseMock = exports.getSignEvmHashResponseMock = exports.getSignEvmTransactionResponseMock = exports.getGetEvmAccountByNameResponseMock = exports.getGetEvmAccountResponseMock = exports.getCreateEvmAccountResponseMock = exports.getListEvmAccountsResponseMock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generated by orval v7.6.0 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Coinbase Developer Platform APIs
|
|
8
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
9
|
+
* OpenAPI spec version: 2.0.0
|
|
10
|
+
*/
|
|
11
|
+
const faker_1 = require("@faker-js/faker");
|
|
12
|
+
const msw_1 = require("msw");
|
|
13
|
+
const getListEvmAccountsResponseMock = () => ({ ...{ accounts: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]) })) }, ...{ nextPageToken: faker_1.faker.helpers.arrayElement([faker_1.faker.string.alpha(20), undefined]) }, });
|
|
14
|
+
exports.getListEvmAccountsResponseMock = getListEvmAccountsResponseMock;
|
|
15
|
+
const getCreateEvmAccountResponseMock = (overrideResponse = {}) => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]), ...overrideResponse });
|
|
16
|
+
exports.getCreateEvmAccountResponseMock = getCreateEvmAccountResponseMock;
|
|
17
|
+
const getGetEvmAccountResponseMock = (overrideResponse = {}) => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]), ...overrideResponse });
|
|
18
|
+
exports.getGetEvmAccountResponseMock = getGetEvmAccountResponseMock;
|
|
19
|
+
const getGetEvmAccountByNameResponseMock = (overrideResponse = {}) => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]), ...overrideResponse });
|
|
20
|
+
exports.getGetEvmAccountByNameResponseMock = getGetEvmAccountByNameResponseMock;
|
|
21
|
+
const getSignEvmTransactionResponseMock = (overrideResponse = {}) => ({ signedTransaction: faker_1.faker.string.alpha(20), ...overrideResponse });
|
|
22
|
+
exports.getSignEvmTransactionResponseMock = getSignEvmTransactionResponseMock;
|
|
23
|
+
const getSignEvmHashResponseMock = (overrideResponse = {}) => ({ signature: faker_1.faker.string.alpha(20), ...overrideResponse });
|
|
24
|
+
exports.getSignEvmHashResponseMock = getSignEvmHashResponseMock;
|
|
25
|
+
const getSignEvmMessageResponseMock = (overrideResponse = {}) => ({ signature: faker_1.faker.string.alpha(20), ...overrideResponse });
|
|
26
|
+
exports.getSignEvmMessageResponseMock = getSignEvmMessageResponseMock;
|
|
27
|
+
const getListEvmAccountsMockHandler = (overrideResponse) => {
|
|
28
|
+
return msw_1.http.get('*/v2/evm/accounts', async (info) => {
|
|
29
|
+
await (0, msw_1.delay)(0);
|
|
30
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
31
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
32
|
+
: (0, exports.getListEvmAccountsResponseMock)()), { status: 200,
|
|
33
|
+
headers: { 'Content-Type': 'application/json' }
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.getListEvmAccountsMockHandler = getListEvmAccountsMockHandler;
|
|
38
|
+
const getCreateEvmAccountMockHandler = (overrideResponse) => {
|
|
39
|
+
return msw_1.http.post('*/v2/evm/accounts', async (info) => {
|
|
40
|
+
await (0, msw_1.delay)(0);
|
|
41
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
42
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
43
|
+
: (0, exports.getCreateEvmAccountResponseMock)()), { status: 201,
|
|
44
|
+
headers: { 'Content-Type': 'application/json' }
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.getCreateEvmAccountMockHandler = getCreateEvmAccountMockHandler;
|
|
49
|
+
const getGetEvmAccountMockHandler = (overrideResponse) => {
|
|
50
|
+
return msw_1.http.get('*/v2/evm/accounts/:address', async (info) => {
|
|
51
|
+
await (0, msw_1.delay)(0);
|
|
52
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
53
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
54
|
+
: (0, exports.getGetEvmAccountResponseMock)()), { status: 200,
|
|
55
|
+
headers: { 'Content-Type': 'application/json' }
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
exports.getGetEvmAccountMockHandler = getGetEvmAccountMockHandler;
|
|
60
|
+
const getGetEvmAccountByNameMockHandler = (overrideResponse) => {
|
|
61
|
+
return msw_1.http.get('*/v2/evm/accounts/by-name/:name', async (info) => {
|
|
62
|
+
await (0, msw_1.delay)(0);
|
|
63
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
64
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
65
|
+
: (0, exports.getGetEvmAccountByNameResponseMock)()), { status: 200,
|
|
66
|
+
headers: { 'Content-Type': 'application/json' }
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
exports.getGetEvmAccountByNameMockHandler = getGetEvmAccountByNameMockHandler;
|
|
71
|
+
const getSignEvmTransactionMockHandler = (overrideResponse) => {
|
|
72
|
+
return msw_1.http.post('*/v2/evm/accounts/:address/sign/transaction', async (info) => {
|
|
73
|
+
await (0, msw_1.delay)(0);
|
|
74
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
75
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
76
|
+
: (0, exports.getSignEvmTransactionResponseMock)()), { status: 200,
|
|
77
|
+
headers: { 'Content-Type': 'application/json' }
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
exports.getSignEvmTransactionMockHandler = getSignEvmTransactionMockHandler;
|
|
82
|
+
const getSignEvmHashMockHandler = (overrideResponse) => {
|
|
83
|
+
return msw_1.http.post('*/v2/evm/accounts/:address/sign', async (info) => {
|
|
84
|
+
await (0, msw_1.delay)(0);
|
|
85
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
86
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
87
|
+
: (0, exports.getSignEvmHashResponseMock)()), { status: 200,
|
|
88
|
+
headers: { 'Content-Type': 'application/json' }
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.getSignEvmHashMockHandler = getSignEvmHashMockHandler;
|
|
93
|
+
const getSignEvmMessageMockHandler = (overrideResponse) => {
|
|
94
|
+
return msw_1.http.post('*/v2/evm/accounts/:address/sign/message', async (info) => {
|
|
95
|
+
await (0, msw_1.delay)(0);
|
|
96
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
97
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
98
|
+
: (0, exports.getSignEvmMessageResponseMock)()), { status: 200,
|
|
99
|
+
headers: { 'Content-Type': 'application/json' }
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
exports.getSignEvmMessageMockHandler = getSignEvmMessageMockHandler;
|
|
104
|
+
const getEvmAccountsMock = () => [
|
|
105
|
+
(0, exports.getListEvmAccountsMockHandler)(),
|
|
106
|
+
(0, exports.getCreateEvmAccountMockHandler)(),
|
|
107
|
+
(0, exports.getGetEvmAccountMockHandler)(),
|
|
108
|
+
(0, exports.getGetEvmAccountByNameMockHandler)(),
|
|
109
|
+
(0, exports.getSignEvmTransactionMockHandler)(),
|
|
110
|
+
(0, exports.getSignEvmHashMockHandler)(),
|
|
111
|
+
(0, exports.getSignEvmMessageMockHandler)()
|
|
112
|
+
];
|
|
113
|
+
exports.getEvmAccountsMock = getEvmAccountsMock;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { CreateEvmSmartAccountBody, EvmSmartAccount, EvmUserOperation, ListEvmSmartAccounts200, ListEvmSmartAccountsParams, PrepareUserOperationBody, SendUserOperationBody } from '../coinbaseDeveloperPlatformAPIs.schemas';
|
|
9
|
+
import { cdpApiClient } from '../../cdpApiClient';
|
|
10
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
11
|
+
/**
|
|
12
|
+
* Lists the Smart Accounts belonging to the developer's CDP Project.
|
|
13
|
+
The response is paginated, and by default, returns 20 accounts per page.
|
|
14
|
+
* @summary List Smart Accounts
|
|
15
|
+
*/
|
|
16
|
+
export declare const listEvmSmartAccounts: (params?: ListEvmSmartAccountsParams, options?: SecondParameter<typeof cdpApiClient>) => Promise<ListEvmSmartAccounts200>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new Smart Account.
|
|
19
|
+
* @summary Create a Smart Account
|
|
20
|
+
*/
|
|
21
|
+
export declare const createEvmSmartAccount: (createEvmSmartAccountBody: CreateEvmSmartAccountBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmSmartAccount>;
|
|
22
|
+
/**
|
|
23
|
+
* Gets a Smart Account by its address.
|
|
24
|
+
* @summary Get a Smart Account by address
|
|
25
|
+
*/
|
|
26
|
+
export declare const getEvmSmartAccount: (address: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmSmartAccount>;
|
|
27
|
+
/**
|
|
28
|
+
* Prepares a new user operation on a Smart Account for a specific network.
|
|
29
|
+
* @summary Prepare a user operation
|
|
30
|
+
*/
|
|
31
|
+
export declare const prepareUserOperation: (address: string, prepareUserOperationBody: PrepareUserOperationBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmUserOperation>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets a user operation by its hash.
|
|
34
|
+
* @summary Get a user operation
|
|
35
|
+
*/
|
|
36
|
+
export declare const getUserOperation: (address: string, userOpHash: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmUserOperation>;
|
|
37
|
+
/**
|
|
38
|
+
* Sends a user operation with a signature.
|
|
39
|
+
* @summary Send a user operation
|
|
40
|
+
*/
|
|
41
|
+
export declare const sendUserOperation: (address: string, userOpHash: string, sendUserOperationBody: SendUserOperationBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<EvmUserOperation>;
|
|
42
|
+
export type ListEvmSmartAccountsResult = NonNullable<Awaited<ReturnType<typeof listEvmSmartAccounts>>>;
|
|
43
|
+
export type CreateEvmSmartAccountResult = NonNullable<Awaited<ReturnType<typeof createEvmSmartAccount>>>;
|
|
44
|
+
export type GetEvmSmartAccountResult = NonNullable<Awaited<ReturnType<typeof getEvmSmartAccount>>>;
|
|
45
|
+
export type PrepareUserOperationResult = NonNullable<Awaited<ReturnType<typeof prepareUserOperation>>>;
|
|
46
|
+
export type GetUserOperationResult = NonNullable<Awaited<ReturnType<typeof getUserOperation>>>;
|
|
47
|
+
export type SendUserOperationResult = NonNullable<Awaited<ReturnType<typeof sendUserOperation>>>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendUserOperation = exports.getUserOperation = exports.prepareUserOperation = exports.getEvmSmartAccount = exports.createEvmSmartAccount = exports.listEvmSmartAccounts = void 0;
|
|
4
|
+
const cdpApiClient_1 = require("../../cdpApiClient");
|
|
5
|
+
/**
|
|
6
|
+
* Lists the Smart Accounts belonging to the developer's CDP Project.
|
|
7
|
+
The response is paginated, and by default, returns 20 accounts per page.
|
|
8
|
+
* @summary List Smart Accounts
|
|
9
|
+
*/
|
|
10
|
+
const listEvmSmartAccounts = (params, options) => {
|
|
11
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/smart-accounts`, method: 'GET',
|
|
12
|
+
params
|
|
13
|
+
}, options);
|
|
14
|
+
};
|
|
15
|
+
exports.listEvmSmartAccounts = listEvmSmartAccounts;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new Smart Account.
|
|
18
|
+
* @summary Create a Smart Account
|
|
19
|
+
*/
|
|
20
|
+
const createEvmSmartAccount = (createEvmSmartAccountBody, options) => {
|
|
21
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/smart-accounts`, method: 'POST',
|
|
22
|
+
headers: { 'Content-Type': 'application/json', },
|
|
23
|
+
data: createEvmSmartAccountBody
|
|
24
|
+
}, options);
|
|
25
|
+
};
|
|
26
|
+
exports.createEvmSmartAccount = createEvmSmartAccount;
|
|
27
|
+
/**
|
|
28
|
+
* Gets a Smart Account by its address.
|
|
29
|
+
* @summary Get a Smart Account by address
|
|
30
|
+
*/
|
|
31
|
+
const getEvmSmartAccount = (address, options) => {
|
|
32
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/smart-accounts/${address}`, method: 'GET'
|
|
33
|
+
}, options);
|
|
34
|
+
};
|
|
35
|
+
exports.getEvmSmartAccount = getEvmSmartAccount;
|
|
36
|
+
/**
|
|
37
|
+
* Prepares a new user operation on a Smart Account for a specific network.
|
|
38
|
+
* @summary Prepare a user operation
|
|
39
|
+
*/
|
|
40
|
+
const prepareUserOperation = (address, prepareUserOperationBody, options) => {
|
|
41
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/smart-accounts/${address}/user-operations`, method: 'POST',
|
|
42
|
+
headers: { 'Content-Type': 'application/json', },
|
|
43
|
+
data: prepareUserOperationBody
|
|
44
|
+
}, options);
|
|
45
|
+
};
|
|
46
|
+
exports.prepareUserOperation = prepareUserOperation;
|
|
47
|
+
/**
|
|
48
|
+
* Gets a user operation by its hash.
|
|
49
|
+
* @summary Get a user operation
|
|
50
|
+
*/
|
|
51
|
+
const getUserOperation = (address, userOpHash, options) => {
|
|
52
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/smart-accounts/${address}/user-operations/${userOpHash}`, method: 'GET'
|
|
53
|
+
}, options);
|
|
54
|
+
};
|
|
55
|
+
exports.getUserOperation = getUserOperation;
|
|
56
|
+
/**
|
|
57
|
+
* Sends a user operation with a signature.
|
|
58
|
+
* @summary Send a user operation
|
|
59
|
+
*/
|
|
60
|
+
const sendUserOperation = (address, userOpHash, sendUserOperationBody, options) => {
|
|
61
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/smart-accounts/${address}/user-operations/${userOpHash}/send`, method: 'POST',
|
|
62
|
+
headers: { 'Content-Type': 'application/json', },
|
|
63
|
+
data: sendUserOperationBody
|
|
64
|
+
}, options);
|
|
65
|
+
};
|
|
66
|
+
exports.sendUserOperation = sendUserOperation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { http } from 'msw';
|
|
2
|
+
import type { EvmSmartAccount, EvmUserOperation, ListEvmSmartAccounts200 } from '../coinbaseDeveloperPlatformAPIs.schemas';
|
|
3
|
+
export declare const getListEvmSmartAccountsResponseMock: () => ListEvmSmartAccounts200;
|
|
4
|
+
export declare const getCreateEvmSmartAccountResponseMock: (overrideResponse?: Partial<EvmSmartAccount>) => EvmSmartAccount;
|
|
5
|
+
export declare const getGetEvmSmartAccountResponseMock: (overrideResponse?: Partial<EvmSmartAccount>) => EvmSmartAccount;
|
|
6
|
+
export declare const getPrepareUserOperationResponseMock: (overrideResponse?: Partial<EvmUserOperation>) => EvmUserOperation;
|
|
7
|
+
export declare const getGetUserOperationResponseMock: (overrideResponse?: Partial<EvmUserOperation>) => EvmUserOperation;
|
|
8
|
+
export declare const getSendUserOperationResponseMock: (overrideResponse?: Partial<EvmUserOperation>) => EvmUserOperation;
|
|
9
|
+
export declare const getListEvmSmartAccountsMockHandler: (overrideResponse?: ListEvmSmartAccounts200 | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<ListEvmSmartAccounts200> | ListEvmSmartAccounts200)) => import("msw").HttpHandler;
|
|
10
|
+
export declare const getCreateEvmSmartAccountMockHandler: (overrideResponse?: EvmSmartAccount | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EvmSmartAccount> | EvmSmartAccount)) => import("msw").HttpHandler;
|
|
11
|
+
export declare const getGetEvmSmartAccountMockHandler: (overrideResponse?: EvmSmartAccount | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<EvmSmartAccount> | EvmSmartAccount)) => import("msw").HttpHandler;
|
|
12
|
+
export declare const getPrepareUserOperationMockHandler: (overrideResponse?: EvmUserOperation | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EvmUserOperation> | EvmUserOperation)) => import("msw").HttpHandler;
|
|
13
|
+
export declare const getGetUserOperationMockHandler: (overrideResponse?: EvmUserOperation | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<EvmUserOperation> | EvmUserOperation)) => import("msw").HttpHandler;
|
|
14
|
+
export declare const getSendUserOperationMockHandler: (overrideResponse?: EvmUserOperation | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EvmUserOperation> | EvmUserOperation)) => import("msw").HttpHandler;
|
|
15
|
+
export declare const getEvmSmartAccountsMock: () => import("msw").HttpHandler[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEvmSmartAccountsMock = exports.getSendUserOperationMockHandler = exports.getGetUserOperationMockHandler = exports.getPrepareUserOperationMockHandler = exports.getGetEvmSmartAccountMockHandler = exports.getCreateEvmSmartAccountMockHandler = exports.getListEvmSmartAccountsMockHandler = exports.getSendUserOperationResponseMock = exports.getGetUserOperationResponseMock = exports.getPrepareUserOperationResponseMock = exports.getGetEvmSmartAccountResponseMock = exports.getCreateEvmSmartAccountResponseMock = exports.getListEvmSmartAccountsResponseMock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generated by orval v7.6.0 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Coinbase Developer Platform APIs
|
|
8
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
9
|
+
* OpenAPI spec version: 2.0.0
|
|
10
|
+
*/
|
|
11
|
+
const faker_1 = require("@faker-js/faker");
|
|
12
|
+
const msw_1 = require("msw");
|
|
13
|
+
const getListEvmSmartAccountsResponseMock = () => ({ ...{ accounts: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), owners: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => (faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'))), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]) })) }, ...{ nextPageToken: faker_1.faker.helpers.arrayElement([faker_1.faker.string.alpha(20), undefined]) }, });
|
|
14
|
+
exports.getListEvmSmartAccountsResponseMock = getListEvmSmartAccountsResponseMock;
|
|
15
|
+
const getCreateEvmSmartAccountResponseMock = (overrideResponse = {}) => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), owners: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => (faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'))), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]), ...overrideResponse });
|
|
16
|
+
exports.getCreateEvmSmartAccountResponseMock = getCreateEvmSmartAccountResponseMock;
|
|
17
|
+
const getGetEvmSmartAccountResponseMock = (overrideResponse = {}) => ({ address: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), owners: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => (faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'))), name: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$'), undefined]), ...overrideResponse });
|
|
18
|
+
exports.getGetEvmSmartAccountResponseMock = getGetEvmSmartAccountResponseMock;
|
|
19
|
+
const getPrepareUserOperationResponseMock = (overrideResponse = {}) => ({ network: faker_1.faker.helpers.arrayElement(['base-sepolia', 'base']), userOpHash: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{64}$'), calls: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ to: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), value: faker_1.faker.string.alpha(20), data: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]*$') })), status: faker_1.faker.helpers.arrayElement(['pending', 'signed', 'broadcast', 'complete', 'failed']), transactionHash: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{64}$|^$'), undefined]), ...overrideResponse });
|
|
20
|
+
exports.getPrepareUserOperationResponseMock = getPrepareUserOperationResponseMock;
|
|
21
|
+
const getGetUserOperationResponseMock = (overrideResponse = {}) => ({ network: faker_1.faker.helpers.arrayElement(['base-sepolia', 'base']), userOpHash: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{64}$'), calls: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ to: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), value: faker_1.faker.string.alpha(20), data: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]*$') })), status: faker_1.faker.helpers.arrayElement(['pending', 'signed', 'broadcast', 'complete', 'failed']), transactionHash: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{64}$|^$'), undefined]), ...overrideResponse });
|
|
22
|
+
exports.getGetUserOperationResponseMock = getGetUserOperationResponseMock;
|
|
23
|
+
const getSendUserOperationResponseMock = (overrideResponse = {}) => ({ network: faker_1.faker.helpers.arrayElement(['base-sepolia', 'base']), userOpHash: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{64}$'), calls: Array.from({ length: faker_1.faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ to: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{40}$'), value: faker_1.faker.string.alpha(20), data: faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]*$') })), status: faker_1.faker.helpers.arrayElement(['pending', 'signed', 'broadcast', 'complete', 'failed']), transactionHash: faker_1.faker.helpers.arrayElement([faker_1.faker.helpers.fromRegExp('^0x[0-9a-fA-F]{64}$|^$'), undefined]), ...overrideResponse });
|
|
24
|
+
exports.getSendUserOperationResponseMock = getSendUserOperationResponseMock;
|
|
25
|
+
const getListEvmSmartAccountsMockHandler = (overrideResponse) => {
|
|
26
|
+
return msw_1.http.get('*/v2/evm/smart-accounts', async (info) => {
|
|
27
|
+
await (0, msw_1.delay)(0);
|
|
28
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
29
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
30
|
+
: (0, exports.getListEvmSmartAccountsResponseMock)()), { status: 200,
|
|
31
|
+
headers: { 'Content-Type': 'application/json' }
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.getListEvmSmartAccountsMockHandler = getListEvmSmartAccountsMockHandler;
|
|
36
|
+
const getCreateEvmSmartAccountMockHandler = (overrideResponse) => {
|
|
37
|
+
return msw_1.http.post('*/v2/evm/smart-accounts', async (info) => {
|
|
38
|
+
await (0, msw_1.delay)(0);
|
|
39
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
40
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
41
|
+
: (0, exports.getCreateEvmSmartAccountResponseMock)()), { status: 201,
|
|
42
|
+
headers: { 'Content-Type': 'application/json' }
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.getCreateEvmSmartAccountMockHandler = getCreateEvmSmartAccountMockHandler;
|
|
47
|
+
const getGetEvmSmartAccountMockHandler = (overrideResponse) => {
|
|
48
|
+
return msw_1.http.get('*/v2/evm/smart-accounts/:address', async (info) => {
|
|
49
|
+
await (0, msw_1.delay)(0);
|
|
50
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
51
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
52
|
+
: (0, exports.getGetEvmSmartAccountResponseMock)()), { status: 200,
|
|
53
|
+
headers: { 'Content-Type': 'application/json' }
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.getGetEvmSmartAccountMockHandler = getGetEvmSmartAccountMockHandler;
|
|
58
|
+
const getPrepareUserOperationMockHandler = (overrideResponse) => {
|
|
59
|
+
return msw_1.http.post('*/v2/evm/smart-accounts/:address/user-operations', async (info) => {
|
|
60
|
+
await (0, msw_1.delay)(0);
|
|
61
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
62
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
63
|
+
: (0, exports.getPrepareUserOperationResponseMock)()), { status: 201,
|
|
64
|
+
headers: { 'Content-Type': 'application/json' }
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.getPrepareUserOperationMockHandler = getPrepareUserOperationMockHandler;
|
|
69
|
+
const getGetUserOperationMockHandler = (overrideResponse) => {
|
|
70
|
+
return msw_1.http.get('*/v2/evm/smart-accounts/:address/user-operations/:userOpHash', async (info) => {
|
|
71
|
+
await (0, msw_1.delay)(0);
|
|
72
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
73
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
74
|
+
: (0, exports.getGetUserOperationResponseMock)()), { status: 200,
|
|
75
|
+
headers: { 'Content-Type': 'application/json' }
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
exports.getGetUserOperationMockHandler = getGetUserOperationMockHandler;
|
|
80
|
+
const getSendUserOperationMockHandler = (overrideResponse) => {
|
|
81
|
+
return msw_1.http.post('*/v2/evm/smart-accounts/:address/user-operations/:userOpHash/send', async (info) => {
|
|
82
|
+
await (0, msw_1.delay)(0);
|
|
83
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
84
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
85
|
+
: (0, exports.getSendUserOperationResponseMock)()), { status: 200,
|
|
86
|
+
headers: { 'Content-Type': 'application/json' }
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
exports.getSendUserOperationMockHandler = getSendUserOperationMockHandler;
|
|
91
|
+
const getEvmSmartAccountsMock = () => [
|
|
92
|
+
(0, exports.getListEvmSmartAccountsMockHandler)(),
|
|
93
|
+
(0, exports.getCreateEvmSmartAccountMockHandler)(),
|
|
94
|
+
(0, exports.getGetEvmSmartAccountMockHandler)(),
|
|
95
|
+
(0, exports.getPrepareUserOperationMockHandler)(),
|
|
96
|
+
(0, exports.getGetUserOperationMockHandler)(),
|
|
97
|
+
(0, exports.getSendUserOperationMockHandler)()
|
|
98
|
+
];
|
|
99
|
+
exports.getEvmSmartAccountsMock = getEvmSmartAccountsMock;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { RequestEvmFaucet200, RequestEvmFaucetBody, RequestSolanaFaucet200, RequestSolanaFaucetBody } from '../coinbaseDeveloperPlatformAPIs.schemas';
|
|
9
|
+
import { cdpApiClient } from '../../cdpApiClient';
|
|
10
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
11
|
+
/**
|
|
12
|
+
* Request funds from the CDP Faucet on supported EVM test networks.
|
|
13
|
+
|
|
14
|
+
Faucets are available for ETH, USDC, EURC, and cbBTC on Base Sepolia and Ethereum Sepolia.
|
|
15
|
+
|
|
16
|
+
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
|
|
17
|
+
These limits are applied at both the CDP User level and the blockchain address level.
|
|
18
|
+
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
|
|
19
|
+
|
|
20
|
+
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|
|
21
|
+
|:-----:|:-------------------------:|:--------------------------------:|
|
|
22
|
+
| ETH | 0.0001 ETH | 0.001 ETH |
|
|
23
|
+
| USDC | 1 USDC | 10 USDC |
|
|
24
|
+
| EURC | 1 EURC | 10 EURC |
|
|
25
|
+
| cbBTC | 0.0001 cbBTC | 0.001 cbBTC |
|
|
26
|
+
|
|
27
|
+
* @summary Request funds on EVM test networks
|
|
28
|
+
*/
|
|
29
|
+
export declare const requestEvmFaucet: (requestEvmFaucetBody: RequestEvmFaucetBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<RequestEvmFaucet200>;
|
|
30
|
+
/**
|
|
31
|
+
* Request funds from the CDP Faucet on Solana devnet.
|
|
32
|
+
|
|
33
|
+
Faucets are available for SOL.
|
|
34
|
+
|
|
35
|
+
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
|
|
36
|
+
These limits are applied at both the CDP User level and the blockchain address level.
|
|
37
|
+
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
|
|
38
|
+
|
|
39
|
+
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|
|
40
|
+
|:-----:|:-------------------------:|:--------------------------------:|
|
|
41
|
+
| SOL | 0.00125 SOL | 0.0125 SOL |
|
|
42
|
+
|
|
43
|
+
* @summary Request funds on Solana devnet
|
|
44
|
+
*/
|
|
45
|
+
export declare const requestSolanaFaucet: (requestSolanaFaucetBody: RequestSolanaFaucetBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<RequestSolanaFaucet200>;
|
|
46
|
+
export type RequestEvmFaucetResult = NonNullable<Awaited<ReturnType<typeof requestEvmFaucet>>>;
|
|
47
|
+
export type RequestSolanaFaucetResult = NonNullable<Awaited<ReturnType<typeof requestSolanaFaucet>>>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestSolanaFaucet = exports.requestEvmFaucet = void 0;
|
|
4
|
+
const cdpApiClient_1 = require("../../cdpApiClient");
|
|
5
|
+
/**
|
|
6
|
+
* Request funds from the CDP Faucet on supported EVM test networks.
|
|
7
|
+
|
|
8
|
+
Faucets are available for ETH, USDC, EURC, and cbBTC on Base Sepolia and Ethereum Sepolia.
|
|
9
|
+
|
|
10
|
+
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
|
|
11
|
+
These limits are applied at both the CDP User level and the blockchain address level.
|
|
12
|
+
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
|
|
13
|
+
|
|
14
|
+
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|
|
15
|
+
|:-----:|:-------------------------:|:--------------------------------:|
|
|
16
|
+
| ETH | 0.0001 ETH | 0.001 ETH |
|
|
17
|
+
| USDC | 1 USDC | 10 USDC |
|
|
18
|
+
| EURC | 1 EURC | 10 EURC |
|
|
19
|
+
| cbBTC | 0.0001 cbBTC | 0.001 cbBTC |
|
|
20
|
+
|
|
21
|
+
* @summary Request funds on EVM test networks
|
|
22
|
+
*/
|
|
23
|
+
const requestEvmFaucet = (requestEvmFaucetBody, options) => {
|
|
24
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/evm/faucet`, method: 'POST',
|
|
25
|
+
headers: { 'Content-Type': 'application/json', },
|
|
26
|
+
data: requestEvmFaucetBody
|
|
27
|
+
}, options);
|
|
28
|
+
};
|
|
29
|
+
exports.requestEvmFaucet = requestEvmFaucet;
|
|
30
|
+
/**
|
|
31
|
+
* Request funds from the CDP Faucet on Solana devnet.
|
|
32
|
+
|
|
33
|
+
Faucets are available for SOL.
|
|
34
|
+
|
|
35
|
+
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
|
|
36
|
+
These limits are applied at both the CDP User level and the blockchain address level.
|
|
37
|
+
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
|
|
38
|
+
|
|
39
|
+
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|
|
40
|
+
|:-----:|:-------------------------:|:--------------------------------:|
|
|
41
|
+
| SOL | 0.00125 SOL | 0.0125 SOL |
|
|
42
|
+
|
|
43
|
+
* @summary Request funds on Solana devnet
|
|
44
|
+
*/
|
|
45
|
+
const requestSolanaFaucet = (requestSolanaFaucetBody, options) => {
|
|
46
|
+
return (0, cdpApiClient_1.cdpApiClient)({ url: `/v2/solana/faucet`, method: 'POST',
|
|
47
|
+
headers: { 'Content-Type': 'application/json', },
|
|
48
|
+
data: requestSolanaFaucetBody
|
|
49
|
+
}, options);
|
|
50
|
+
};
|
|
51
|
+
exports.requestSolanaFaucet = requestSolanaFaucet;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { http } from 'msw';
|
|
2
|
+
import type { RequestEvmFaucet200, RequestSolanaFaucet200 } from '../coinbaseDeveloperPlatformAPIs.schemas';
|
|
3
|
+
export declare const getRequestEvmFaucetResponseMock: (overrideResponse?: Partial<RequestEvmFaucet200>) => RequestEvmFaucet200;
|
|
4
|
+
export declare const getRequestSolanaFaucetResponseMock: (overrideResponse?: Partial<RequestSolanaFaucet200>) => RequestSolanaFaucet200;
|
|
5
|
+
export declare const getRequestEvmFaucetMockHandler: (overrideResponse?: RequestEvmFaucet200 | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<RequestEvmFaucet200> | RequestEvmFaucet200)) => import("msw").HttpHandler;
|
|
6
|
+
export declare const getRequestSolanaFaucetMockHandler: (overrideResponse?: RequestSolanaFaucet200 | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<RequestSolanaFaucet200> | RequestSolanaFaucet200)) => import("msw").HttpHandler;
|
|
7
|
+
export declare const getFaucetsMock: () => import("msw").HttpHandler[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFaucetsMock = exports.getRequestSolanaFaucetMockHandler = exports.getRequestEvmFaucetMockHandler = exports.getRequestSolanaFaucetResponseMock = exports.getRequestEvmFaucetResponseMock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generated by orval v7.6.0 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Coinbase Developer Platform APIs
|
|
8
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
9
|
+
* OpenAPI spec version: 2.0.0
|
|
10
|
+
*/
|
|
11
|
+
const faker_1 = require("@faker-js/faker");
|
|
12
|
+
const msw_1 = require("msw");
|
|
13
|
+
const getRequestEvmFaucetResponseMock = (overrideResponse = {}) => ({ transactionHash: faker_1.faker.string.alpha(20), ...overrideResponse });
|
|
14
|
+
exports.getRequestEvmFaucetResponseMock = getRequestEvmFaucetResponseMock;
|
|
15
|
+
const getRequestSolanaFaucetResponseMock = (overrideResponse = {}) => ({ transactionSignature: faker_1.faker.string.alpha(20), ...overrideResponse });
|
|
16
|
+
exports.getRequestSolanaFaucetResponseMock = getRequestSolanaFaucetResponseMock;
|
|
17
|
+
const getRequestEvmFaucetMockHandler = (overrideResponse) => {
|
|
18
|
+
return msw_1.http.post('*/v2/evm/faucet', async (info) => {
|
|
19
|
+
await (0, msw_1.delay)(0);
|
|
20
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
21
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
22
|
+
: (0, exports.getRequestEvmFaucetResponseMock)()), { status: 200,
|
|
23
|
+
headers: { 'Content-Type': 'application/json' }
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
exports.getRequestEvmFaucetMockHandler = getRequestEvmFaucetMockHandler;
|
|
28
|
+
const getRequestSolanaFaucetMockHandler = (overrideResponse) => {
|
|
29
|
+
return msw_1.http.post('*/v2/solana/faucet', async (info) => {
|
|
30
|
+
await (0, msw_1.delay)(0);
|
|
31
|
+
return new msw_1.HttpResponse(JSON.stringify(overrideResponse !== undefined
|
|
32
|
+
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
|
33
|
+
: (0, exports.getRequestSolanaFaucetResponseMock)()), { status: 200,
|
|
34
|
+
headers: { 'Content-Type': 'application/json' }
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.getRequestSolanaFaucetMockHandler = getRequestSolanaFaucetMockHandler;
|
|
39
|
+
const getFaucetsMock = () => [
|
|
40
|
+
(0, exports.getRequestEvmFaucetMockHandler)(),
|
|
41
|
+
(0, exports.getRequestSolanaFaucetMockHandler)()
|
|
42
|
+
];
|
|
43
|
+
exports.getFaucetsMock = getFaucetsMock;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./solana-accounts/solana-accounts.msw"), exports);
|
|
18
|
+
__exportStar(require("./evm-accounts/evm-accounts.msw"), exports);
|
|
19
|
+
__exportStar(require("./faucets/faucets.msw"), exports);
|
|
20
|
+
__exportStar(require("./evm-smart-accounts/evm-smart-accounts.msw"), exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { CreateSolanaAccountBody, ListSolanaAccounts200, ListSolanaAccountsParams, SignSolanaMessage200, SignSolanaMessageBody, SignSolanaTransaction200, SignSolanaTransactionBody, SolanaAccount } from '../coinbaseDeveloperPlatformAPIs.schemas';
|
|
9
|
+
import { cdpApiClient } from '../../cdpApiClient';
|
|
10
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
11
|
+
/**
|
|
12
|
+
* Lists the Solana accounts belonging to the developer.
|
|
13
|
+
The response is paginated, and by default, returns 20 accounts per page.
|
|
14
|
+
|
|
15
|
+
If a name is provided, the response will contain only the account with that name.
|
|
16
|
+
* @summary List Solana accounts or get account by name
|
|
17
|
+
*/
|
|
18
|
+
export declare const listSolanaAccounts: (params?: ListSolanaAccountsParams, options?: SecondParameter<typeof cdpApiClient>) => Promise<ListSolanaAccounts200>;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new Solana account.
|
|
21
|
+
* @summary Create a Solana account
|
|
22
|
+
*/
|
|
23
|
+
export declare const createSolanaAccount: (createSolanaAccountBody?: CreateSolanaAccountBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SolanaAccount>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets a Solana account by its address.
|
|
26
|
+
* @summary Get a Solana account by address
|
|
27
|
+
*/
|
|
28
|
+
export declare const getSolanaAccount: (address: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<SolanaAccount>;
|
|
29
|
+
/**
|
|
30
|
+
* Gets a Solana account by its name.
|
|
31
|
+
* @summary Get a Solana account by name
|
|
32
|
+
*/
|
|
33
|
+
export declare const getSolanaAccountByName: (name: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<SolanaAccount>;
|
|
34
|
+
/**
|
|
35
|
+
* Signs a transaction with the given Solana account.
|
|
36
|
+
The unsigned transaction should be serialized into a byte array and then encoded as base64.
|
|
37
|
+
|
|
38
|
+
**Transaction types**
|
|
39
|
+
|
|
40
|
+
The following transaction types are supported:
|
|
41
|
+
* [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
|
|
42
|
+
* [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
|
|
43
|
+
|
|
44
|
+
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
45
|
+
* @summary Sign a transaction
|
|
46
|
+
*/
|
|
47
|
+
export declare const signSolanaTransaction: (address: string, signSolanaTransactionBody: SignSolanaTransactionBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SignSolanaTransaction200>;
|
|
48
|
+
/**
|
|
49
|
+
* Signs an arbitrary message with the given Solana account.
|
|
50
|
+
|
|
51
|
+
**WARNING:** Never sign a message that you didn't generate, as it can be an arbitrary transaction. For example, it might send all of your funds to an attacker.
|
|
52
|
+
* @summary Sign a message
|
|
53
|
+
*/
|
|
54
|
+
export declare const signSolanaMessage: (address: string, signSolanaMessageBody: SignSolanaMessageBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SignSolanaMessage200>;
|
|
55
|
+
export type ListSolanaAccountsResult = NonNullable<Awaited<ReturnType<typeof listSolanaAccounts>>>;
|
|
56
|
+
export type CreateSolanaAccountResult = NonNullable<Awaited<ReturnType<typeof createSolanaAccount>>>;
|
|
57
|
+
export type GetSolanaAccountResult = NonNullable<Awaited<ReturnType<typeof getSolanaAccount>>>;
|
|
58
|
+
export type GetSolanaAccountByNameResult = NonNullable<Awaited<ReturnType<typeof getSolanaAccountByName>>>;
|
|
59
|
+
export type SignSolanaTransactionResult = NonNullable<Awaited<ReturnType<typeof signSolanaTransaction>>>;
|
|
60
|
+
export type SignSolanaMessageResult = NonNullable<Awaited<ReturnType<typeof signSolanaMessage>>>;
|
|
61
|
+
export {};
|