@compass-labs/api-sdk 2.2.62-rc.0 → 2.2.63-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/codeSamples_typescript.yaml +6 -0
- package/dist/commonjs/funcs/tokenizedAssetsTokenizedAssetsTransfer.d.ts +35 -0
- package/dist/commonjs/funcs/tokenizedAssetsTokenizedAssetsTransfer.d.ts.map +1 -0
- package/dist/commonjs/funcs/tokenizedAssetsTokenizedAssetsTransfer.js +136 -0
- package/dist/commonjs/funcs/tokenizedAssetsTokenizedAssetsTransfer.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/tokenizedassetstransferrequest.d.ts +69 -0
- package/dist/commonjs/models/components/tokenizedassetstransferrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/tokenizedassetstransferrequest.js +76 -0
- package/dist/commonjs/models/components/tokenizedassetstransferrequest.js.map +1 -0
- package/dist/commonjs/models/components/tokenizedassetstransferresponse.d.ts +27 -0
- package/dist/commonjs/models/components/tokenizedassetstransferresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/tokenizedassetstransferresponse.js +71 -0
- package/dist/commonjs/models/components/tokenizedassetstransferresponse.js.map +1 -0
- package/dist/commonjs/sdk/tokenizedassets.d.ts +24 -0
- package/dist/commonjs/sdk/tokenizedassets.d.ts.map +1 -1
- package/dist/commonjs/sdk/tokenizedassets.js +27 -0
- package/dist/commonjs/sdk/tokenizedassets.js.map +1 -1
- package/dist/esm/funcs/tokenizedAssetsTokenizedAssetsTransfer.d.ts +35 -0
- package/dist/esm/funcs/tokenizedAssetsTokenizedAssetsTransfer.d.ts.map +1 -0
- package/dist/esm/funcs/tokenizedAssetsTokenizedAssetsTransfer.js +100 -0
- package/dist/esm/funcs/tokenizedAssetsTokenizedAssetsTransfer.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/tokenizedassetstransferrequest.d.ts +69 -0
- package/dist/esm/models/components/tokenizedassetstransferrequest.d.ts.map +1 -0
- package/dist/esm/models/components/tokenizedassetstransferrequest.js +38 -0
- package/dist/esm/models/components/tokenizedassetstransferrequest.js.map +1 -0
- package/dist/esm/models/components/tokenizedassetstransferresponse.d.ts +27 -0
- package/dist/esm/models/components/tokenizedassetstransferresponse.d.ts.map +1 -0
- package/dist/esm/models/components/tokenizedassetstransferresponse.js +33 -0
- package/dist/esm/models/components/tokenizedassetstransferresponse.js.map +1 -0
- package/dist/esm/sdk/tokenizedassets.d.ts +24 -0
- package/dist/esm/sdk/tokenizedassets.d.ts.map +1 -1
- package/dist/esm/sdk/tokenizedassets.js +27 -0
- package/dist/esm/sdk/tokenizedassets.js.map +1 -1
- package/docs/models/components/tokenizedassetstransferrequest.md +27 -0
- package/docs/models/components/tokenizedassetstransferrequestaction.md +17 -0
- package/docs/models/components/tokenizedassetstransferrequestamount.md +19 -0
- package/docs/models/components/tokenizedassetstransferresponse.md +76 -0
- package/docs/models/components/tokenizedassetstransferresponseeip712.md +99 -0
- package/docs/sdks/tokenizedassets/README.md +101 -0
- package/openapi_prepped_for_speakeasy.json +164 -0
- package/package.json +1 -1
- package/src/funcs/tokenizedAssetsTokenizedAssetsTransfer.ts +193 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/tokenizedassetstransferrequest.ts +124 -0
- package/src/models/components/tokenizedassetstransferresponse.ts +93 -0
- package/src/sdk/tokenizedassets.ts +35 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Deposit to / withdraw from a Tokenized Assets Account
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Move tokens between the owner's wallet and their Tokenized Assets Account.
|
|
34
|
+
*
|
|
35
|
+
* Use `DEPOSIT` to fund the account from the owner's wallet, or `WITHDRAW` to
|
|
36
|
+
* send tokens from the account back to the owner. Equity orders settle in
|
|
37
|
+
* USDC; RWA yield assets trade against USDC on Ethereum and Base.
|
|
38
|
+
*
|
|
39
|
+
* With `gas_sponsorship=true` the response is EIP-712 typed data the owner
|
|
40
|
+
* signs off-chain, then submits to `POST /v2/gas_sponsorship/prepare` so the
|
|
41
|
+
* sponsor broadcasts and pays the gas:
|
|
42
|
+
*
|
|
43
|
+
* - **DEPOSIT** returns a Permit2 `PermitTransferFrom`. The owner must first
|
|
44
|
+
* grant a one-time token->Permit2 allowance (gaslessly via
|
|
45
|
+
* `POST /v2/gas_sponsorship/approve_transfer`).
|
|
46
|
+
* - **WITHDRAW** returns a Safe transaction the account executes.
|
|
47
|
+
*
|
|
48
|
+
* With `gas_sponsorship=false` a DEPOSIT returns an unsigned ERC-20 transfer
|
|
49
|
+
* the owner broadcasts directly, and a WITHDRAW returns an unsigned Safe
|
|
50
|
+
* `execTransaction` the owner signs and broadcasts.
|
|
51
|
+
*/
|
|
52
|
+
export function tokenizedAssetsTokenizedAssetsTransfer(
|
|
53
|
+
client: CompassApiSDKCore,
|
|
54
|
+
request: components.TokenizedAssetsTransferRequest,
|
|
55
|
+
options?: RequestOptions,
|
|
56
|
+
): APIPromise<
|
|
57
|
+
Result<
|
|
58
|
+
components.TokenizedAssetsTransferResponse,
|
|
59
|
+
| errors.TokenizedAssetsErrorResponse
|
|
60
|
+
| errors.HTTPValidationError
|
|
61
|
+
| CompassAPISDKError
|
|
62
|
+
| ResponseValidationError
|
|
63
|
+
| ConnectionError
|
|
64
|
+
| RequestAbortedError
|
|
65
|
+
| RequestTimeoutError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| UnexpectedClientError
|
|
68
|
+
| SDKValidationError
|
|
69
|
+
>
|
|
70
|
+
> {
|
|
71
|
+
return new APIPromise($do(
|
|
72
|
+
client,
|
|
73
|
+
request,
|
|
74
|
+
options,
|
|
75
|
+
));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function $do(
|
|
79
|
+
client: CompassApiSDKCore,
|
|
80
|
+
request: components.TokenizedAssetsTransferRequest,
|
|
81
|
+
options?: RequestOptions,
|
|
82
|
+
): Promise<
|
|
83
|
+
[
|
|
84
|
+
Result<
|
|
85
|
+
components.TokenizedAssetsTransferResponse,
|
|
86
|
+
| errors.TokenizedAssetsErrorResponse
|
|
87
|
+
| errors.HTTPValidationError
|
|
88
|
+
| CompassAPISDKError
|
|
89
|
+
| ResponseValidationError
|
|
90
|
+
| ConnectionError
|
|
91
|
+
| RequestAbortedError
|
|
92
|
+
| RequestTimeoutError
|
|
93
|
+
| InvalidRequestError
|
|
94
|
+
| UnexpectedClientError
|
|
95
|
+
| SDKValidationError
|
|
96
|
+
>,
|
|
97
|
+
APICall,
|
|
98
|
+
]
|
|
99
|
+
> {
|
|
100
|
+
const parsed = safeParse(
|
|
101
|
+
request,
|
|
102
|
+
(value) =>
|
|
103
|
+
components.TokenizedAssetsTransferRequest$outboundSchema.parse(value),
|
|
104
|
+
"Input validation failed",
|
|
105
|
+
);
|
|
106
|
+
if (!parsed.ok) {
|
|
107
|
+
return [parsed, { status: "invalid" }];
|
|
108
|
+
}
|
|
109
|
+
const payload = parsed.value;
|
|
110
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
111
|
+
|
|
112
|
+
const path = pathToFunc("/v2/tokenized_assets/transfer")();
|
|
113
|
+
|
|
114
|
+
const headers = new Headers(compactMap({
|
|
115
|
+
"Content-Type": "application/json",
|
|
116
|
+
Accept: "application/json",
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
120
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
121
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
122
|
+
|
|
123
|
+
const context = {
|
|
124
|
+
options: client._options,
|
|
125
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
126
|
+
operationID: "v2_tokenized_assets_transfer",
|
|
127
|
+
oAuth2Scopes: null,
|
|
128
|
+
|
|
129
|
+
resolvedSecurity: requestSecurity,
|
|
130
|
+
|
|
131
|
+
securitySource: client._options.apiKeyAuth,
|
|
132
|
+
retryConfig: options?.retries
|
|
133
|
+
|| client._options.retryConfig
|
|
134
|
+
|| { strategy: "none" },
|
|
135
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const requestRes = client._createRequest(context, {
|
|
139
|
+
security: requestSecurity,
|
|
140
|
+
method: "POST",
|
|
141
|
+
baseURL: options?.serverURL,
|
|
142
|
+
path: path,
|
|
143
|
+
headers: headers,
|
|
144
|
+
body: body,
|
|
145
|
+
userAgent: client._options.userAgent,
|
|
146
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
147
|
+
}, options);
|
|
148
|
+
if (!requestRes.ok) {
|
|
149
|
+
return [requestRes, { status: "invalid" }];
|
|
150
|
+
}
|
|
151
|
+
const req = requestRes.value;
|
|
152
|
+
|
|
153
|
+
const doResult = await client._do(req, {
|
|
154
|
+
context,
|
|
155
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
156
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
157
|
+
retryConfig: context.retryConfig,
|
|
158
|
+
retryCodes: context.retryCodes,
|
|
159
|
+
});
|
|
160
|
+
if (!doResult.ok) {
|
|
161
|
+
return [doResult, { status: "request-error", request: req }];
|
|
162
|
+
}
|
|
163
|
+
const response = doResult.value;
|
|
164
|
+
|
|
165
|
+
const responseFields = {
|
|
166
|
+
HttpMeta: { Response: response, Request: req },
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const [result] = await M.match<
|
|
170
|
+
components.TokenizedAssetsTransferResponse,
|
|
171
|
+
| errors.TokenizedAssetsErrorResponse
|
|
172
|
+
| errors.HTTPValidationError
|
|
173
|
+
| CompassAPISDKError
|
|
174
|
+
| ResponseValidationError
|
|
175
|
+
| ConnectionError
|
|
176
|
+
| RequestAbortedError
|
|
177
|
+
| RequestTimeoutError
|
|
178
|
+
| InvalidRequestError
|
|
179
|
+
| UnexpectedClientError
|
|
180
|
+
| SDKValidationError
|
|
181
|
+
>(
|
|
182
|
+
M.json(200, components.TokenizedAssetsTransferResponse$inboundSchema),
|
|
183
|
+
M.jsonErr(400, errors.TokenizedAssetsErrorResponse$inboundSchema),
|
|
184
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
185
|
+
M.fail("4XX"),
|
|
186
|
+
M.fail("5XX"),
|
|
187
|
+
)(response, req, { extraFields: responseFields });
|
|
188
|
+
if (!result.ok) {
|
|
189
|
+
return [result, { status: "complete", request: req, response }];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return [result, { status: "complete", request: req, response }];
|
|
193
|
+
}
|
|
@@ -299,6 +299,8 @@ export * from "./tokenizedassetssubmitorderrequest.js";
|
|
|
299
299
|
export * from "./tokenizedassetssubmitorderresponse.js";
|
|
300
300
|
export * from "./tokenizedassetstraderequest.js";
|
|
301
301
|
export * from "./tokenizedassetstraderesponse.js";
|
|
302
|
+
export * from "./tokenizedassetstransferrequest.js";
|
|
303
|
+
export * from "./tokenizedassetstransferresponse.js";
|
|
302
304
|
export * from "./tokenlistresponse.js";
|
|
303
305
|
export * from "./tokenmarketdata.js";
|
|
304
306
|
export * from "./tokenpermissions.js";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Chain, Chain$outboundSchema } from "./chain.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The amount of tokens to transfer (in token units, not wei).
|
|
12
|
+
*/
|
|
13
|
+
export type TokenizedAssetsTransferRequestAmount = number | string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Whether you are depositing to or withdrawing from your Tokenized Assets Account.
|
|
17
|
+
*/
|
|
18
|
+
export const TokenizedAssetsTransferRequestAction = {
|
|
19
|
+
Deposit: "DEPOSIT",
|
|
20
|
+
Withdraw: "WITHDRAW",
|
|
21
|
+
} as const;
|
|
22
|
+
/**
|
|
23
|
+
* Whether you are depositing to or withdrawing from your Tokenized Assets Account.
|
|
24
|
+
*/
|
|
25
|
+
export type TokenizedAssetsTransferRequestAction = ClosedEnum<
|
|
26
|
+
typeof TokenizedAssetsTransferRequestAction
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export type TokenizedAssetsTransferRequest = {
|
|
30
|
+
/**
|
|
31
|
+
* The owner's wallet address (EOA).
|
|
32
|
+
*/
|
|
33
|
+
owner: string;
|
|
34
|
+
/**
|
|
35
|
+
* The chain to use.
|
|
36
|
+
*/
|
|
37
|
+
chain?: Chain | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The token to transfer. Tokenized-asset orders settle in USDC.
|
|
40
|
+
*/
|
|
41
|
+
token: string;
|
|
42
|
+
/**
|
|
43
|
+
* The amount of tokens to transfer (in token units, not wei).
|
|
44
|
+
*/
|
|
45
|
+
amount: number | string;
|
|
46
|
+
/**
|
|
47
|
+
* Whether you are depositing to or withdrawing from your Tokenized Assets Account.
|
|
48
|
+
*/
|
|
49
|
+
action: TokenizedAssetsTransferRequestAction;
|
|
50
|
+
/**
|
|
51
|
+
* Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
|
|
52
|
+
*/
|
|
53
|
+
gasSponsorship?: boolean | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The address that will call Permit2's permitTransferFrom to execute the transfer. When `action` is 'DEPOSIT' and `gas_sponsorship` is `true`: - If provided, the signature will authorize this address (typically a gas sponsor) to pull tokens. - If not provided, defaults to the Tokenized Assets Account (Safe) address, allowing the transfer to be included in a bundle transaction where the Safe pulls the tokens itself.
|
|
56
|
+
*/
|
|
57
|
+
spender?: string | null | undefined;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export type TokenizedAssetsTransferRequestAmount$Outbound = number | string;
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const TokenizedAssetsTransferRequestAmount$outboundSchema: z.ZodType<
|
|
65
|
+
TokenizedAssetsTransferRequestAmount$Outbound,
|
|
66
|
+
z.ZodTypeDef,
|
|
67
|
+
TokenizedAssetsTransferRequestAmount
|
|
68
|
+
> = z.union([z.number(), z.string()]);
|
|
69
|
+
|
|
70
|
+
export function tokenizedAssetsTransferRequestAmountToJSON(
|
|
71
|
+
tokenizedAssetsTransferRequestAmount: TokenizedAssetsTransferRequestAmount,
|
|
72
|
+
): string {
|
|
73
|
+
return JSON.stringify(
|
|
74
|
+
TokenizedAssetsTransferRequestAmount$outboundSchema.parse(
|
|
75
|
+
tokenizedAssetsTransferRequestAmount,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** @internal */
|
|
81
|
+
export const TokenizedAssetsTransferRequestAction$outboundSchema:
|
|
82
|
+
z.ZodNativeEnum<typeof TokenizedAssetsTransferRequestAction> = z.nativeEnum(
|
|
83
|
+
TokenizedAssetsTransferRequestAction,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export type TokenizedAssetsTransferRequest$Outbound = {
|
|
88
|
+
owner: string;
|
|
89
|
+
chain?: string | undefined;
|
|
90
|
+
token: string;
|
|
91
|
+
amount: number | string;
|
|
92
|
+
action: string;
|
|
93
|
+
gas_sponsorship?: boolean | undefined;
|
|
94
|
+
spender?: string | null | undefined;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** @internal */
|
|
98
|
+
export const TokenizedAssetsTransferRequest$outboundSchema: z.ZodType<
|
|
99
|
+
TokenizedAssetsTransferRequest$Outbound,
|
|
100
|
+
z.ZodTypeDef,
|
|
101
|
+
TokenizedAssetsTransferRequest
|
|
102
|
+
> = z.object({
|
|
103
|
+
owner: z.string(),
|
|
104
|
+
chain: Chain$outboundSchema.optional(),
|
|
105
|
+
token: z.string(),
|
|
106
|
+
amount: z.union([z.number(), z.string()]),
|
|
107
|
+
action: TokenizedAssetsTransferRequestAction$outboundSchema,
|
|
108
|
+
gasSponsorship: z.boolean().optional(),
|
|
109
|
+
spender: z.nullable(z.string()).optional(),
|
|
110
|
+
}).transform((v) => {
|
|
111
|
+
return remap$(v, {
|
|
112
|
+
gasSponsorship: "gas_sponsorship",
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export function tokenizedAssetsTransferRequestToJSON(
|
|
117
|
+
tokenizedAssetsTransferRequest: TokenizedAssetsTransferRequest,
|
|
118
|
+
): string {
|
|
119
|
+
return JSON.stringify(
|
|
120
|
+
TokenizedAssetsTransferRequest$outboundSchema.parse(
|
|
121
|
+
tokenizedAssetsTransferRequest,
|
|
122
|
+
),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
BatchedSafeOperationsResponseOutput,
|
|
12
|
+
BatchedSafeOperationsResponseOutput$inboundSchema,
|
|
13
|
+
} from "./batchedsafeoperationsresponseoutput.js";
|
|
14
|
+
import {
|
|
15
|
+
Permit2TypedDataOutput,
|
|
16
|
+
Permit2TypedDataOutput$inboundSchema,
|
|
17
|
+
} from "./permit2typeddataoutput.js";
|
|
18
|
+
import {
|
|
19
|
+
UnsignedTransaction,
|
|
20
|
+
UnsignedTransaction$inboundSchema,
|
|
21
|
+
} from "./unsignedtransaction.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* EIP-712 typed data for gas-sponsored execution. Present when `gas_sponsorship=true`. A Permit2 `PermitTransferFrom` for DEPOSIT, or a Safe transaction for WITHDRAW. The owner signs it and submits to `/v2/gas_sponsorship/prepare`.
|
|
25
|
+
*/
|
|
26
|
+
export type TokenizedAssetsTransferResponseEip712 =
|
|
27
|
+
| BatchedSafeOperationsResponseOutput
|
|
28
|
+
| Permit2TypedDataOutput;
|
|
29
|
+
|
|
30
|
+
export type TokenizedAssetsTransferResponse = {
|
|
31
|
+
/**
|
|
32
|
+
* Unsigned transaction for direct execution. Present when `gas_sponsorship=false`.
|
|
33
|
+
*/
|
|
34
|
+
transaction?: UnsignedTransaction | null | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* EIP-712 typed data for gas-sponsored execution. Present when `gas_sponsorship=true`. A Permit2 `PermitTransferFrom` for DEPOSIT, or a Safe transaction for WITHDRAW. The owner signs it and submits to `/v2/gas_sponsorship/prepare`.
|
|
37
|
+
*/
|
|
38
|
+
eip712?:
|
|
39
|
+
| BatchedSafeOperationsResponseOutput
|
|
40
|
+
| Permit2TypedDataOutput
|
|
41
|
+
| null
|
|
42
|
+
| undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const TokenizedAssetsTransferResponseEip712$inboundSchema: z.ZodType<
|
|
47
|
+
TokenizedAssetsTransferResponseEip712,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
unknown
|
|
50
|
+
> = z.union([
|
|
51
|
+
BatchedSafeOperationsResponseOutput$inboundSchema,
|
|
52
|
+
Permit2TypedDataOutput$inboundSchema,
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
export function tokenizedAssetsTransferResponseEip712FromJSON(
|
|
56
|
+
jsonString: string,
|
|
57
|
+
): SafeParseResult<TokenizedAssetsTransferResponseEip712, SDKValidationError> {
|
|
58
|
+
return safeParse(
|
|
59
|
+
jsonString,
|
|
60
|
+
(x) =>
|
|
61
|
+
TokenizedAssetsTransferResponseEip712$inboundSchema.parse(JSON.parse(x)),
|
|
62
|
+
`Failed to parse 'TokenizedAssetsTransferResponseEip712' from JSON`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @internal */
|
|
67
|
+
export const TokenizedAssetsTransferResponse$inboundSchema: z.ZodType<
|
|
68
|
+
TokenizedAssetsTransferResponse,
|
|
69
|
+
z.ZodTypeDef,
|
|
70
|
+
unknown
|
|
71
|
+
> = z.object({
|
|
72
|
+
transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
|
|
73
|
+
eip_712: z.nullable(
|
|
74
|
+
z.union([
|
|
75
|
+
BatchedSafeOperationsResponseOutput$inboundSchema,
|
|
76
|
+
Permit2TypedDataOutput$inboundSchema,
|
|
77
|
+
]),
|
|
78
|
+
).optional(),
|
|
79
|
+
}).transform((v) => {
|
|
80
|
+
return remap$(v, {
|
|
81
|
+
"eip_712": "eip712",
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export function tokenizedAssetsTransferResponseFromJSON(
|
|
86
|
+
jsonString: string,
|
|
87
|
+
): SafeParseResult<TokenizedAssetsTransferResponse, SDKValidationError> {
|
|
88
|
+
return safeParse(
|
|
89
|
+
jsonString,
|
|
90
|
+
(x) => TokenizedAssetsTransferResponse$inboundSchema.parse(JSON.parse(x)),
|
|
91
|
+
`Failed to parse 'TokenizedAssetsTransferResponse' from JSON`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -13,6 +13,7 @@ import { tokenizedAssetsTokenizedAssetsPositions } from "../funcs/tokenizedAsset
|
|
|
13
13
|
import { tokenizedAssetsTokenizedAssetsQuote } from "../funcs/tokenizedAssetsTokenizedAssetsQuote.js";
|
|
14
14
|
import { tokenizedAssetsTokenizedAssetsTransactBuy } from "../funcs/tokenizedAssetsTokenizedAssetsTransactBuy.js";
|
|
15
15
|
import { tokenizedAssetsTokenizedAssetsTransactSell } from "../funcs/tokenizedAssetsTokenizedAssetsTransactSell.js";
|
|
16
|
+
import { tokenizedAssetsTokenizedAssetsTransfer } from "../funcs/tokenizedAssetsTokenizedAssetsTransfer.js";
|
|
16
17
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
17
18
|
import * as components from "../models/components/index.js";
|
|
18
19
|
import * as operations from "../models/operations/index.js";
|
|
@@ -160,6 +161,40 @@ export class TokenizedAssets extends ClientSDK {
|
|
|
160
161
|
));
|
|
161
162
|
}
|
|
162
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Deposit to / withdraw from a Tokenized Assets Account
|
|
166
|
+
*
|
|
167
|
+
* @remarks
|
|
168
|
+
* Move tokens between the owner's wallet and their Tokenized Assets Account.
|
|
169
|
+
*
|
|
170
|
+
* Use `DEPOSIT` to fund the account from the owner's wallet, or `WITHDRAW` to
|
|
171
|
+
* send tokens from the account back to the owner. Equity orders settle in
|
|
172
|
+
* USDC; RWA yield assets trade against USDC on Ethereum and Base.
|
|
173
|
+
*
|
|
174
|
+
* With `gas_sponsorship=true` the response is EIP-712 typed data the owner
|
|
175
|
+
* signs off-chain, then submits to `POST /v2/gas_sponsorship/prepare` so the
|
|
176
|
+
* sponsor broadcasts and pays the gas:
|
|
177
|
+
*
|
|
178
|
+
* - **DEPOSIT** returns a Permit2 `PermitTransferFrom`. The owner must first
|
|
179
|
+
* grant a one-time token->Permit2 allowance (gaslessly via
|
|
180
|
+
* `POST /v2/gas_sponsorship/approve_transfer`).
|
|
181
|
+
* - **WITHDRAW** returns a Safe transaction the account executes.
|
|
182
|
+
*
|
|
183
|
+
* With `gas_sponsorship=false` a DEPOSIT returns an unsigned ERC-20 transfer
|
|
184
|
+
* the owner broadcasts directly, and a WITHDRAW returns an unsigned Safe
|
|
185
|
+
* `execTransaction` the owner signs and broadcasts.
|
|
186
|
+
*/
|
|
187
|
+
async tokenizedAssetsTransfer(
|
|
188
|
+
request: components.TokenizedAssetsTransferRequest,
|
|
189
|
+
options?: RequestOptions,
|
|
190
|
+
): Promise<components.TokenizedAssetsTransferResponse> {
|
|
191
|
+
return unwrapAsync(tokenizedAssetsTokenizedAssetsTransfer(
|
|
192
|
+
this,
|
|
193
|
+
request,
|
|
194
|
+
options,
|
|
195
|
+
));
|
|
196
|
+
}
|
|
197
|
+
|
|
163
198
|
/**
|
|
164
199
|
* Preview a buy/sell quote
|
|
165
200
|
*
|