@distilled.cloud/coinbase 0.17.0 → 0.18.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/lib/credentials.d.ts +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +16 -10
- package/lib/credentials.js.map +1 -1
- package/lib/operations/createEvmEip7702DelegationWithEndUserAccount.d.ts +51 -0
- package/lib/operations/createEvmEip7702DelegationWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/createEvmEip7702DelegationWithEndUserAccount.js +62 -0
- package/lib/operations/createEvmEip7702DelegationWithEndUserAccount.js.map +1 -0
- package/lib/operations/getDelegationForEndUser.d.ts +25 -0
- package/lib/operations/getDelegationForEndUser.d.ts.map +1 -0
- package/lib/operations/getDelegationForEndUser.js +31 -0
- package/lib/operations/getDelegationForEndUser.js.map +1 -0
- package/lib/operations/revokeDelegationForEndUser.d.ts +32 -0
- package/lib/operations/revokeDelegationForEndUser.d.ts.map +1 -0
- package/lib/operations/revokeDelegationForEndUser.js +40 -0
- package/lib/operations/revokeDelegationForEndUser.js.map +1 -0
- package/lib/operations/sendEvmAssetWithEndUserAccount.d.ts +58 -0
- package/lib/operations/sendEvmAssetWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/sendEvmAssetWithEndUserAccount.js +68 -0
- package/lib/operations/sendEvmAssetWithEndUserAccount.js.map +1 -0
- package/lib/operations/sendEvmTransactionWithEndUserAccount.d.ts +61 -0
- package/lib/operations/sendEvmTransactionWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/sendEvmTransactionWithEndUserAccount.js +76 -0
- package/lib/operations/sendEvmTransactionWithEndUserAccount.js.map +1 -0
- package/lib/operations/sendSolanaAssetWithEndUserAccount.d.ts +57 -0
- package/lib/operations/sendSolanaAssetWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/sendSolanaAssetWithEndUserAccount.js +56 -0
- package/lib/operations/sendSolanaAssetWithEndUserAccount.js.map +1 -0
- package/lib/operations/sendSolanaTransactionWithEndUserAccount.d.ts +60 -0
- package/lib/operations/sendSolanaTransactionWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/sendSolanaTransactionWithEndUserAccount.js +62 -0
- package/lib/operations/sendSolanaTransactionWithEndUserAccount.js.map +1 -0
- package/lib/operations/sendUserOperationWithEndUserAccount.d.ts +100 -0
- package/lib/operations/sendUserOperationWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/sendUserOperationWithEndUserAccount.js +105 -0
- package/lib/operations/sendUserOperationWithEndUserAccount.js.map +1 -0
- package/lib/operations/signEvmMessageWithEndUserAccount.d.ts +44 -0
- package/lib/operations/signEvmMessageWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/signEvmMessageWithEndUserAccount.js +48 -0
- package/lib/operations/signEvmMessageWithEndUserAccount.js.map +1 -0
- package/lib/operations/signEvmTransactionWithEndUserAccount.d.ts +45 -0
- package/lib/operations/signEvmTransactionWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/signEvmTransactionWithEndUserAccount.js +49 -0
- package/lib/operations/signEvmTransactionWithEndUserAccount.js.map +1 -0
- package/lib/operations/signEvmTypedDataWithEndUserAccount.d.ts +65 -0
- package/lib/operations/signEvmTypedDataWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/signEvmTypedDataWithEndUserAccount.js +58 -0
- package/lib/operations/signEvmTypedDataWithEndUserAccount.js.map +1 -0
- package/lib/operations/signSolanaMessageWithEndUserAccount.d.ts +44 -0
- package/lib/operations/signSolanaMessageWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/signSolanaMessageWithEndUserAccount.js +48 -0
- package/lib/operations/signSolanaMessageWithEndUserAccount.js.map +1 -0
- package/lib/operations/signSolanaTransactionWithEndUserAccount.d.ts +49 -0
- package/lib/operations/signSolanaTransactionWithEndUserAccount.d.ts.map +1 -0
- package/lib/operations/signSolanaTransactionWithEndUserAccount.js +53 -0
- package/lib/operations/signSolanaTransactionWithEndUserAccount.js.map +1 -0
- package/package.json +2 -2
- package/src/credentials.ts +24 -10
- package/src/operations/createEvmEip7702DelegationWithEndUserAccount.ts +70 -0
- package/src/operations/getDelegationForEndUser.ts +41 -0
- package/src/operations/revokeDelegationForEndUser.ts +50 -0
- package/src/operations/sendEvmAssetWithEndUserAccount.ts +76 -0
- package/src/operations/sendEvmTransactionWithEndUserAccount.ts +84 -0
- package/src/operations/sendSolanaAssetWithEndUserAccount.ts +64 -0
- package/src/operations/sendSolanaTransactionWithEndUserAccount.ts +70 -0
- package/src/operations/sendUserOperationWithEndUserAccount.ts +123 -0
- package/src/operations/signEvmMessageWithEndUserAccount.ts +56 -0
- package/src/operations/signEvmTransactionWithEndUserAccount.ts +57 -0
- package/src/operations/signEvmTypedDataWithEndUserAccount.ts +66 -0
- package/src/operations/signSolanaMessageWithEndUserAccount.ts +56 -0
- package/src/operations/signSolanaTransactionWithEndUserAccount.ts +61 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
// Input Schema
|
|
5
|
+
export const SignEvmTransactionWithEndUserAccountInput =
|
|
6
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
7
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
8
|
+
projectID: Schema.optional(Schema.String),
|
|
9
|
+
address: Schema.String,
|
|
10
|
+
transaction: Schema.String,
|
|
11
|
+
walletSecretId: Schema.optional(Schema.String),
|
|
12
|
+
}).pipe(T.Http({
|
|
13
|
+
method: "POST",
|
|
14
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/evm/sign/transaction",
|
|
15
|
+
}));
|
|
16
|
+
// Output Schema
|
|
17
|
+
export const SignEvmTransactionWithEndUserAccountOutput =
|
|
18
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
19
|
+
signedTransaction: Schema.String,
|
|
20
|
+
});
|
|
21
|
+
// The operation
|
|
22
|
+
/**
|
|
23
|
+
* Sign a transaction with end user EVM account
|
|
24
|
+
*
|
|
25
|
+
* Signs a transaction with the given end user EVM account.
|
|
26
|
+
* The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
|
|
27
|
+
* The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
28
|
+
*
|
|
29
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
30
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
31
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
32
|
+
|
|
33
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
34
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
35
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
36
|
+
|
|
37
|
+
* @param userId - The ID of the end user.
|
|
38
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
39
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
40
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
41
|
+
|
|
42
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
43
|
+
*/
|
|
44
|
+
export const signEvmTransactionWithEndUserAccount =
|
|
45
|
+
/*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
46
|
+
inputSchema: SignEvmTransactionWithEndUserAccountInput,
|
|
47
|
+
outputSchema: SignEvmTransactionWithEndUserAccountOutput,
|
|
48
|
+
}));
|
|
49
|
+
//# sourceMappingURL=signEvmTransactionWithEndUserAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signEvmTransactionWithEndUserAccount.js","sourceRoot":"","sources":["../../src/operations/signEvmTransactionWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,eAAe;AACf,MAAM,CAAC,MAAM,yCAAyC;AACpD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CAC/C,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,IAAI,CAAC;IACL,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,iEAAiE;CACxE,CAAC,CACH,CAAC;AAIJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,0CAA0C;AACrD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC,MAAM;CACjC,CAAC,CAAC;AAIL,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,oCAAoC;AAC/C,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,yCAAyC;IACtD,YAAY,EAAE,0CAA0C;CACzD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export declare const SignEvmTypedDataWithEndUserAccountInput: Schema.Struct<{
|
|
3
|
+
readonly userId: Schema.String;
|
|
4
|
+
readonly projectID: Schema.optional<Schema.String>;
|
|
5
|
+
readonly address: Schema.String;
|
|
6
|
+
readonly typedData: Schema.Struct<{
|
|
7
|
+
readonly domain: Schema.Struct<{
|
|
8
|
+
readonly name: Schema.optional<Schema.String>;
|
|
9
|
+
readonly version: Schema.optional<Schema.String>;
|
|
10
|
+
readonly chainId: Schema.optional<Schema.Number>;
|
|
11
|
+
readonly verifyingContract: Schema.optional<Schema.String>;
|
|
12
|
+
readonly salt: Schema.optional<Schema.String>;
|
|
13
|
+
}>;
|
|
14
|
+
readonly types: Schema.Unknown;
|
|
15
|
+
readonly primaryType: Schema.String;
|
|
16
|
+
readonly message: Schema.Unknown;
|
|
17
|
+
}>;
|
|
18
|
+
readonly walletSecretId: Schema.optional<Schema.String>;
|
|
19
|
+
}>;
|
|
20
|
+
export type SignEvmTypedDataWithEndUserAccountInput = typeof SignEvmTypedDataWithEndUserAccountInput.Type;
|
|
21
|
+
export declare const SignEvmTypedDataWithEndUserAccountOutput: Schema.Struct<{
|
|
22
|
+
readonly signature: Schema.String;
|
|
23
|
+
}>;
|
|
24
|
+
export type SignEvmTypedDataWithEndUserAccountOutput = typeof SignEvmTypedDataWithEndUserAccountOutput.Type;
|
|
25
|
+
/**
|
|
26
|
+
* Sign EIP-712 typed data with end user EVM account
|
|
27
|
+
*
|
|
28
|
+
* Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given end user EVM account.
|
|
29
|
+
*
|
|
30
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
31
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
32
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
33
|
+
|
|
34
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
35
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
36
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
37
|
+
|
|
38
|
+
* @param userId - The ID of the end user.
|
|
39
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
40
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
41
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
42
|
+
|
|
43
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
44
|
+
*/
|
|
45
|
+
export declare const signEvmTypedDataWithEndUserAccount: import("@distilled.cloud/core/client").OperationMethod<{
|
|
46
|
+
readonly address: string;
|
|
47
|
+
readonly projectID?: string | undefined;
|
|
48
|
+
readonly typedData: {
|
|
49
|
+
readonly domain: {
|
|
50
|
+
readonly chainId?: number | undefined;
|
|
51
|
+
readonly name?: string | undefined;
|
|
52
|
+
readonly salt?: string | undefined;
|
|
53
|
+
readonly verifyingContract?: string | undefined;
|
|
54
|
+
readonly version?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
readonly message: unknown;
|
|
57
|
+
readonly primaryType: string;
|
|
58
|
+
readonly types: unknown;
|
|
59
|
+
};
|
|
60
|
+
readonly userId: string;
|
|
61
|
+
readonly walletSecretId?: string | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
readonly signature: string;
|
|
64
|
+
}, never, import("../credentials.ts").Credentials>;
|
|
65
|
+
//# sourceMappingURL=signEvmTypedDataWithEndUserAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signEvmTypedDataWithEndUserAccount.d.ts","sourceRoot":"","sources":["../../src/operations/signEvmTypedDataWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;EAuBjD,CAAC;AACJ,MAAM,MAAM,uCAAuC,GACjD,OAAO,uCAAuC,CAAC,IAAI,CAAC;AAGtD,eAAO,MAAM,wCAAwC;;EAGjD,CAAC;AACL,MAAM,MAAM,wCAAwC,GAClD,OAAO,wCAAwC,CAAC,IAAI,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;kDAI1C,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
// Input Schema
|
|
5
|
+
export const SignEvmTypedDataWithEndUserAccountInput =
|
|
6
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
7
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
8
|
+
projectID: Schema.optional(Schema.String),
|
|
9
|
+
address: Schema.String,
|
|
10
|
+
typedData: Schema.Struct({
|
|
11
|
+
domain: Schema.Struct({
|
|
12
|
+
name: Schema.optional(Schema.String),
|
|
13
|
+
version: Schema.optional(Schema.String),
|
|
14
|
+
chainId: Schema.optional(Schema.Number),
|
|
15
|
+
verifyingContract: Schema.optional(Schema.String),
|
|
16
|
+
salt: Schema.optional(Schema.String),
|
|
17
|
+
}),
|
|
18
|
+
types: Schema.Unknown,
|
|
19
|
+
primaryType: Schema.String,
|
|
20
|
+
message: Schema.Unknown,
|
|
21
|
+
}),
|
|
22
|
+
walletSecretId: Schema.optional(Schema.String),
|
|
23
|
+
}).pipe(T.Http({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data",
|
|
26
|
+
}));
|
|
27
|
+
// Output Schema
|
|
28
|
+
export const SignEvmTypedDataWithEndUserAccountOutput =
|
|
29
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
30
|
+
signature: Schema.String,
|
|
31
|
+
});
|
|
32
|
+
// The operation
|
|
33
|
+
/**
|
|
34
|
+
* Sign EIP-712 typed data with end user EVM account
|
|
35
|
+
*
|
|
36
|
+
* Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given end user EVM account.
|
|
37
|
+
*
|
|
38
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
39
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
40
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
41
|
+
|
|
42
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
43
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
44
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
45
|
+
|
|
46
|
+
* @param userId - The ID of the end user.
|
|
47
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
48
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
49
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
50
|
+
|
|
51
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
52
|
+
*/
|
|
53
|
+
export const signEvmTypedDataWithEndUserAccount =
|
|
54
|
+
/*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
55
|
+
inputSchema: SignEvmTypedDataWithEndUserAccountInput,
|
|
56
|
+
outputSchema: SignEvmTypedDataWithEndUserAccountOutput,
|
|
57
|
+
}));
|
|
58
|
+
//# sourceMappingURL=signEvmTypedDataWithEndUserAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signEvmTypedDataWithEndUserAccount.js","sourceRoot":"","sources":["../../src/operations/signEvmTypedDataWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,eAAe;AACf,MAAM,CAAC,MAAM,uCAAuC;AAClD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YACpC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YACvC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YACvC,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YACjD,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;SACrC,CAAC;QACF,KAAK,EAAE,MAAM,CAAC,OAAO;QACrB,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CAC/C,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,IAAI,CAAC;IACL,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,gEAAgE;CACvE,CAAC,CACH,CAAC;AAIJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,wCAAwC;AACnD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC,MAAM;CACzB,CAAC,CAAC;AAIL,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,kCAAkC;AAC7C,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,uCAAuC;IACpD,YAAY,EAAE,wCAAwC;CACvD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export declare const SignSolanaMessageWithEndUserAccountInput: Schema.Struct<{
|
|
3
|
+
readonly userId: Schema.String;
|
|
4
|
+
readonly projectID: Schema.optional<Schema.String>;
|
|
5
|
+
readonly address: Schema.String;
|
|
6
|
+
readonly message: Schema.String;
|
|
7
|
+
readonly walletSecretId: Schema.optional<Schema.String>;
|
|
8
|
+
}>;
|
|
9
|
+
export type SignSolanaMessageWithEndUserAccountInput = typeof SignSolanaMessageWithEndUserAccountInput.Type;
|
|
10
|
+
export declare const SignSolanaMessageWithEndUserAccountOutput: Schema.Struct<{
|
|
11
|
+
readonly signature: Schema.String;
|
|
12
|
+
}>;
|
|
13
|
+
export type SignSolanaMessageWithEndUserAccountOutput = typeof SignSolanaMessageWithEndUserAccountOutput.Type;
|
|
14
|
+
/**
|
|
15
|
+
* Sign a Base64 encoded message
|
|
16
|
+
*
|
|
17
|
+
* Signs an arbitrary Base64 encoded message with the given Solana account.
|
|
18
|
+
* **WARNING:** Never sign a message that you didn't generate as it may put your funds at risk.
|
|
19
|
+
*
|
|
20
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
21
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
22
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
23
|
+
|
|
24
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
25
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
26
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
27
|
+
|
|
28
|
+
* @param userId - The ID of the end user.
|
|
29
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
30
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
31
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
32
|
+
|
|
33
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
34
|
+
*/
|
|
35
|
+
export declare const signSolanaMessageWithEndUserAccount: import("@distilled.cloud/core/client").OperationMethod<{
|
|
36
|
+
readonly address: string;
|
|
37
|
+
readonly message: string;
|
|
38
|
+
readonly projectID?: string | undefined;
|
|
39
|
+
readonly userId: string;
|
|
40
|
+
readonly walletSecretId?: string | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
readonly signature: string;
|
|
43
|
+
}, never, import("../credentials.ts").Credentials>;
|
|
44
|
+
//# sourceMappingURL=signSolanaMessageWithEndUserAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signSolanaMessageWithEndUserAccount.d.ts","sourceRoot":"","sources":["../../src/operations/signSolanaMessageWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,eAAO,MAAM,wCAAwC;;;;;;EAYlD,CAAC;AACJ,MAAM,MAAM,wCAAwC,GAClD,OAAO,wCAAwC,CAAC,IAAI,CAAC;AAGvD,eAAO,MAAM,yCAAyC;;EAGlD,CAAC;AACL,MAAM,MAAM,yCAAyC,GACnD,OAAO,yCAAyC,CAAC,IAAI,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;kDAI3C,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
// Input Schema
|
|
5
|
+
export const SignSolanaMessageWithEndUserAccountInput =
|
|
6
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
7
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
8
|
+
projectID: Schema.optional(Schema.String),
|
|
9
|
+
address: Schema.String,
|
|
10
|
+
message: Schema.String,
|
|
11
|
+
walletSecretId: Schema.optional(Schema.String),
|
|
12
|
+
}).pipe(T.Http({
|
|
13
|
+
method: "POST",
|
|
14
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/solana/sign/message",
|
|
15
|
+
}));
|
|
16
|
+
// Output Schema
|
|
17
|
+
export const SignSolanaMessageWithEndUserAccountOutput =
|
|
18
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
19
|
+
signature: Schema.String,
|
|
20
|
+
});
|
|
21
|
+
// The operation
|
|
22
|
+
/**
|
|
23
|
+
* Sign a Base64 encoded message
|
|
24
|
+
*
|
|
25
|
+
* Signs an arbitrary Base64 encoded message with the given Solana account.
|
|
26
|
+
* **WARNING:** Never sign a message that you didn't generate as it may put your funds at risk.
|
|
27
|
+
*
|
|
28
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
29
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
30
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
31
|
+
|
|
32
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
33
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
34
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
35
|
+
|
|
36
|
+
* @param userId - The ID of the end user.
|
|
37
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
38
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
39
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
40
|
+
|
|
41
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
42
|
+
*/
|
|
43
|
+
export const signSolanaMessageWithEndUserAccount =
|
|
44
|
+
/*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
45
|
+
inputSchema: SignSolanaMessageWithEndUserAccountInput,
|
|
46
|
+
outputSchema: SignSolanaMessageWithEndUserAccountOutput,
|
|
47
|
+
}));
|
|
48
|
+
//# sourceMappingURL=signSolanaMessageWithEndUserAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signSolanaMessageWithEndUserAccount.js","sourceRoot":"","sources":["../../src/operations/signSolanaMessageWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,eAAe;AACf,MAAM,CAAC,MAAM,wCAAwC;AACnD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CAC/C,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,IAAI,CAAC;IACL,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,gEAAgE;CACvE,CAAC,CACH,CAAC;AAIJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,yCAAyC;AACpD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC,MAAM;CACzB,CAAC,CAAC;AAIL,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,mCAAmC;AAC9C,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,wCAAwC;IACrD,YAAY,EAAE,yCAAyC;CACxD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export declare const SignSolanaTransactionWithEndUserAccountInput: Schema.Struct<{
|
|
3
|
+
readonly userId: Schema.String;
|
|
4
|
+
readonly projectID: Schema.optional<Schema.String>;
|
|
5
|
+
readonly address: Schema.String;
|
|
6
|
+
readonly transaction: Schema.String;
|
|
7
|
+
readonly walletSecretId: Schema.optional<Schema.String>;
|
|
8
|
+
}>;
|
|
9
|
+
export type SignSolanaTransactionWithEndUserAccountInput = typeof SignSolanaTransactionWithEndUserAccountInput.Type;
|
|
10
|
+
export declare const SignSolanaTransactionWithEndUserAccountOutput: Schema.Struct<{
|
|
11
|
+
readonly signedTransaction: Schema.String;
|
|
12
|
+
}>;
|
|
13
|
+
export type SignSolanaTransactionWithEndUserAccountOutput = typeof SignSolanaTransactionWithEndUserAccountOutput.Type;
|
|
14
|
+
/**
|
|
15
|
+
* Sign a transaction with end user Solana account
|
|
16
|
+
*
|
|
17
|
+
* Signs a transaction with the given end user Solana account.
|
|
18
|
+
* The unsigned transaction should be serialized into a byte array and then encoded as base64.
|
|
19
|
+
* **Transaction types**
|
|
20
|
+
* The following transaction types are supported:
|
|
21
|
+
* * [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
|
|
22
|
+
* * [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
|
|
23
|
+
* The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
24
|
+
*
|
|
25
|
+
* @param userId - The ID of the end user.
|
|
26
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
27
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
28
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
29
|
+
|
|
30
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
31
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
32
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
33
|
+
|
|
34
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
35
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
36
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
37
|
+
|
|
38
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
39
|
+
*/
|
|
40
|
+
export declare const signSolanaTransactionWithEndUserAccount: import("@distilled.cloud/core/client").OperationMethod<{
|
|
41
|
+
readonly address: string;
|
|
42
|
+
readonly projectID?: string | undefined;
|
|
43
|
+
readonly transaction: string;
|
|
44
|
+
readonly userId: string;
|
|
45
|
+
readonly walletSecretId?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
readonly signedTransaction: string;
|
|
48
|
+
}, never, import("../credentials.ts").Credentials>;
|
|
49
|
+
//# sourceMappingURL=signSolanaTransactionWithEndUserAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signSolanaTransactionWithEndUserAccount.d.ts","sourceRoot":"","sources":["../../src/operations/signSolanaTransactionWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,eAAO,MAAM,4CAA4C;;;;;;EAYtD,CAAC;AACJ,MAAM,MAAM,4CAA4C,GACtD,OAAO,4CAA4C,CAAC,IAAI,CAAC;AAG3D,eAAO,MAAM,6CAA6C;;EAGtD,CAAC;AACL,MAAM,MAAM,6CAA6C,GACvD,OAAO,6CAA6C,CAAC,IAAI,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,uCAAuC;;;;;;;;kDAI/C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
// Input Schema
|
|
5
|
+
export const SignSolanaTransactionWithEndUserAccountInput =
|
|
6
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
7
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
8
|
+
projectID: Schema.optional(Schema.String),
|
|
9
|
+
address: Schema.String,
|
|
10
|
+
transaction: Schema.String,
|
|
11
|
+
walletSecretId: Schema.optional(Schema.String),
|
|
12
|
+
}).pipe(T.Http({
|
|
13
|
+
method: "POST",
|
|
14
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/solana/sign/transaction",
|
|
15
|
+
}));
|
|
16
|
+
// Output Schema
|
|
17
|
+
export const SignSolanaTransactionWithEndUserAccountOutput =
|
|
18
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
19
|
+
signedTransaction: Schema.String,
|
|
20
|
+
});
|
|
21
|
+
// The operation
|
|
22
|
+
/**
|
|
23
|
+
* Sign a transaction with end user Solana account
|
|
24
|
+
*
|
|
25
|
+
* Signs a transaction with the given end user Solana account.
|
|
26
|
+
* The unsigned transaction should be serialized into a byte array and then encoded as base64.
|
|
27
|
+
* **Transaction types**
|
|
28
|
+
* The following transaction types are supported:
|
|
29
|
+
* * [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
|
|
30
|
+
* * [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
|
|
31
|
+
* The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
|
|
32
|
+
*
|
|
33
|
+
* @param userId - The ID of the end user.
|
|
34
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
35
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
36
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
37
|
+
|
|
38
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
39
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
40
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
41
|
+
|
|
42
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
43
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
44
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
45
|
+
|
|
46
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
47
|
+
*/
|
|
48
|
+
export const signSolanaTransactionWithEndUserAccount =
|
|
49
|
+
/*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
50
|
+
inputSchema: SignSolanaTransactionWithEndUserAccountInput,
|
|
51
|
+
outputSchema: SignSolanaTransactionWithEndUserAccountOutput,
|
|
52
|
+
}));
|
|
53
|
+
//# sourceMappingURL=signSolanaTransactionWithEndUserAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signSolanaTransactionWithEndUserAccount.js","sourceRoot":"","sources":["../../src/operations/signSolanaTransactionWithEndUserAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,eAAe;AACf,MAAM,CAAC,MAAM,4CAA4C;AACvD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CAC/C,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,IAAI,CAAC;IACL,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,oEAAoE;CAC3E,CAAC,CACH,CAAC;AAIJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,6CAA6C;AACxD,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC,MAAM;CACjC,CAAC,CAAC;AAIL,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,uCAAuC;AAClD,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,4CAA4C;IACzD,YAAY,EAAE,6CAA6C;CAC5D,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/coinbase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/alchemy-run/distilled",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"specs:update": "git -C specs/cdp-sdk fetch && git -C specs/cdp-sdk checkout main && git -C specs/cdp-sdk pull"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@distilled.cloud/core": "0.
|
|
76
|
+
"@distilled.cloud/core": "0.18.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/bun": "^1.3.0",
|
package/src/credentials.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import * as EffectConfig from "effect/Config";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
1
3
|
import * as Effect from "effect/Effect";
|
|
2
4
|
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
3
6
|
import * as Redacted from "effect/Redacted";
|
|
4
|
-
import * as Context from "effect/Context";
|
|
5
7
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
6
8
|
|
|
7
9
|
export const DEFAULT_API_BASE_URL = "https://api.cdp.coinbase.com/platform";
|
|
@@ -36,12 +38,28 @@ export class Credentials extends Context.Service<Credentials, Config>()(
|
|
|
36
38
|
"CoinbaseCredentials",
|
|
37
39
|
) {}
|
|
38
40
|
|
|
41
|
+
const envConfig = EffectConfig.all({
|
|
42
|
+
apiKeyId: EffectConfig.option(EffectConfig.string("CDP_API_KEY_ID")),
|
|
43
|
+
apiKeyName: EffectConfig.option(EffectConfig.string("CDP_API_KEY_NAME")),
|
|
44
|
+
apiKeySecret: EffectConfig.string("CDP_API_KEY_SECRET"),
|
|
45
|
+
walletSecret: EffectConfig.option(EffectConfig.string("CDP_WALLET_SECRET")),
|
|
46
|
+
});
|
|
47
|
+
|
|
39
48
|
export const CredentialsFromEnv = Layer.effect(
|
|
40
49
|
Credentials,
|
|
41
50
|
Effect.gen(function* () {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
const config = yield* envConfig.asEffect().pipe(
|
|
52
|
+
Effect.mapError(
|
|
53
|
+
() =>
|
|
54
|
+
new ConfigError({
|
|
55
|
+
message: "CDP_API_KEY_SECRET environment variable is required",
|
|
56
|
+
}),
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const apiKeyId =
|
|
61
|
+
Option.getOrUndefined(config.apiKeyId) ??
|
|
62
|
+
Option.getOrUndefined(config.apiKeyName);
|
|
45
63
|
|
|
46
64
|
if (!apiKeyId) {
|
|
47
65
|
return yield* new ConfigError({
|
|
@@ -50,15 +68,11 @@ export const CredentialsFromEnv = Layer.effect(
|
|
|
50
68
|
});
|
|
51
69
|
}
|
|
52
70
|
|
|
53
|
-
|
|
54
|
-
return yield* new ConfigError({
|
|
55
|
-
message: "CDP_API_KEY_SECRET environment variable is required",
|
|
56
|
-
});
|
|
57
|
-
}
|
|
71
|
+
const walletSecret = Option.getOrUndefined(config.walletSecret);
|
|
58
72
|
|
|
59
73
|
return {
|
|
60
74
|
apiKeyId,
|
|
61
|
-
apiKeySecret: Redacted.make(apiKeySecret),
|
|
75
|
+
apiKeySecret: Redacted.make(config.apiKeySecret),
|
|
62
76
|
walletSecret: walletSecret ? Redacted.make(walletSecret) : undefined,
|
|
63
77
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
64
78
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.ts";
|
|
3
|
+
import * as T from "../traits.ts";
|
|
4
|
+
|
|
5
|
+
// Input Schema
|
|
6
|
+
export const CreateEvmEip7702DelegationWithEndUserAccountInput =
|
|
7
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
8
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
9
|
+
projectID: Schema.optional(Schema.String),
|
|
10
|
+
address: Schema.String,
|
|
11
|
+
network: Schema.Literals([
|
|
12
|
+
"base-sepolia",
|
|
13
|
+
"base",
|
|
14
|
+
"arbitrum",
|
|
15
|
+
"optimism",
|
|
16
|
+
"polygon",
|
|
17
|
+
"ethereum",
|
|
18
|
+
"ethereum-sepolia",
|
|
19
|
+
]),
|
|
20
|
+
enableSpendPermissions: Schema.optional(Schema.Boolean),
|
|
21
|
+
walletSecretId: Schema.optional(Schema.String),
|
|
22
|
+
}).pipe(
|
|
23
|
+
T.Http({
|
|
24
|
+
method: "POST",
|
|
25
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/evm/eip7702/delegation",
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
export type CreateEvmEip7702DelegationWithEndUserAccountInput =
|
|
29
|
+
typeof CreateEvmEip7702DelegationWithEndUserAccountInput.Type;
|
|
30
|
+
|
|
31
|
+
// Output Schema
|
|
32
|
+
export const CreateEvmEip7702DelegationWithEndUserAccountOutput =
|
|
33
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
34
|
+
delegationOperationId: Schema.String,
|
|
35
|
+
});
|
|
36
|
+
export type CreateEvmEip7702DelegationWithEndUserAccountOutput =
|
|
37
|
+
typeof CreateEvmEip7702DelegationWithEndUserAccountOutput.Type;
|
|
38
|
+
|
|
39
|
+
// The operation
|
|
40
|
+
/**
|
|
41
|
+
* Create EIP-7702 delegation for end user EVM account
|
|
42
|
+
*
|
|
43
|
+
* Creates an EIP-7702 delegation for an end user's EVM EOA account, upgrading it with smart account capabilities.
|
|
44
|
+
* This endpoint:
|
|
45
|
+
* - Retrieves delegation artifacts from onchain
|
|
46
|
+
* - Signs the EIP-7702 authorization for delegation
|
|
47
|
+
* - Assembles and submits a Type 4 transaction
|
|
48
|
+
* - Creates an associated smart account object
|
|
49
|
+
* The delegation allows the EVM EOA to be used as a smart account, which enables batched transactions and gas sponsorship via paymaster.
|
|
50
|
+
*
|
|
51
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
52
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
53
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
54
|
+
|
|
55
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
56
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
57
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
58
|
+
|
|
59
|
+
* @param userId - The ID of the end user.
|
|
60
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
61
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
62
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
63
|
+
|
|
64
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
65
|
+
*/
|
|
66
|
+
export const createEvmEip7702DelegationWithEndUserAccount =
|
|
67
|
+
/*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
68
|
+
inputSchema: CreateEvmEip7702DelegationWithEndUserAccountInput,
|
|
69
|
+
outputSchema: CreateEvmEip7702DelegationWithEndUserAccountOutput,
|
|
70
|
+
}));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.ts";
|
|
3
|
+
import * as T from "../traits.ts";
|
|
4
|
+
|
|
5
|
+
// Input Schema
|
|
6
|
+
export const GetDelegationForEndUserInput =
|
|
7
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
8
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
9
|
+
projectID: Schema.optional(Schema.String),
|
|
10
|
+
}).pipe(
|
|
11
|
+
T.Http({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/delegation",
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
export type GetDelegationForEndUserInput =
|
|
17
|
+
typeof GetDelegationForEndUserInput.Type;
|
|
18
|
+
|
|
19
|
+
// Output Schema
|
|
20
|
+
export const GetDelegationForEndUserOutput =
|
|
21
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
22
|
+
expiresAt: Schema.String,
|
|
23
|
+
});
|
|
24
|
+
export type GetDelegationForEndUserOutput =
|
|
25
|
+
typeof GetDelegationForEndUserOutput.Type;
|
|
26
|
+
|
|
27
|
+
// The operation
|
|
28
|
+
/**
|
|
29
|
+
* Get delegation for end user
|
|
30
|
+
*
|
|
31
|
+
* Returns the active delegation for the specified end user, if one exists. This operation can be performed by the end user themselves or by a developer using their API key.
|
|
32
|
+
*
|
|
33
|
+
* @param userId - The ID of the end user.
|
|
34
|
+
* @param projectID - The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
|
|
35
|
+
*/
|
|
36
|
+
export const getDelegationForEndUser = /*@__PURE__*/ /*#__PURE__*/ API.make(
|
|
37
|
+
() => ({
|
|
38
|
+
inputSchema: GetDelegationForEndUserInput,
|
|
39
|
+
outputSchema: GetDelegationForEndUserOutput,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.ts";
|
|
3
|
+
import * as T from "../traits.ts";
|
|
4
|
+
|
|
5
|
+
// Input Schema
|
|
6
|
+
export const RevokeDelegationForEndUserInput =
|
|
7
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
8
|
+
userId: Schema.String.pipe(T.PathParam()),
|
|
9
|
+
walletSecretId: Schema.optional(Schema.String),
|
|
10
|
+
}).pipe(
|
|
11
|
+
T.Http({
|
|
12
|
+
method: "DELETE",
|
|
13
|
+
path: "/v2/embedded-wallet-api/end-users/{userId}/delegation",
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
export type RevokeDelegationForEndUserInput =
|
|
17
|
+
typeof RevokeDelegationForEndUserInput.Type;
|
|
18
|
+
|
|
19
|
+
// Output Schema
|
|
20
|
+
export const RevokeDelegationForEndUserOutput =
|
|
21
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Void;
|
|
22
|
+
export type RevokeDelegationForEndUserOutput =
|
|
23
|
+
typeof RevokeDelegationForEndUserOutput.Type;
|
|
24
|
+
|
|
25
|
+
// The operation
|
|
26
|
+
/**
|
|
27
|
+
* Revoke delegation for end user
|
|
28
|
+
*
|
|
29
|
+
* Revokes all active delegations for the specified end user. This operation can be performed by the end user themselves or by a developer using their API key.
|
|
30
|
+
*
|
|
31
|
+
* @param X-Wallet-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
32
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
33
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
34
|
+
|
|
35
|
+
* @param X-Developer-Auth - A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
36
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
37
|
+
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
38
|
+
|
|
39
|
+
* @param X-Idempotency-Key - An optional string request header for making requests safely retryable.
|
|
40
|
+
When included, duplicate requests with the same key will return identical responses.
|
|
41
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
42
|
+
|
|
43
|
+
* @param userId - The ID of the end user.
|
|
44
|
+
*/
|
|
45
|
+
export const revokeDelegationForEndUser = /*@__PURE__*/ /*#__PURE__*/ API.make(
|
|
46
|
+
() => ({
|
|
47
|
+
inputSchema: RevokeDelegationForEndUserInput,
|
|
48
|
+
outputSchema: RevokeDelegationForEndUserOutput,
|
|
49
|
+
}),
|
|
50
|
+
);
|