@tixprotocol/tdp-sdk 0.3.0 → 0.5.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 +21 -0
- package/dist/{chunk-RLIW34CX.js → chunk-7IWD2KHF.js} +15 -3
- package/dist/chunk-7IWD2KHF.js.map +1 -0
- package/dist/{chunk-QXWVXLHK.js → chunk-MZKCWS5T.js} +73 -45
- package/dist/chunk-MZKCWS5T.js.map +1 -0
- package/dist/errors.d.ts +14 -3
- package/dist/errors.js +5 -1
- package/dist/index.d.ts +826 -174
- package/dist/index.js +182 -111
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +26 -61
- package/dist/schemas.js +13 -13
- package/package.json +1 -1
- package/dist/chunk-QXWVXLHK.js.map +0 -1
- package/dist/chunk-RLIW34CX.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,50 +1,71 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AcceptClaimOffersRequestBodySchema,
|
|
3
|
-
AcceptClaimOffersResponseSchema,
|
|
4
2
|
ApiKeyHeadersSchema,
|
|
3
|
+
CreateAndSubmitOrderRequestBodySchema,
|
|
4
|
+
CreateAndSubmitOrderResponseSchema,
|
|
5
5
|
EventPathParametersSchema,
|
|
6
6
|
GetAddressResponseSchema,
|
|
7
|
-
|
|
7
|
+
GetOrderResponseSchema,
|
|
8
8
|
IdempotencyKeyAndApiKeyHeadersSchema,
|
|
9
|
-
MAX_PERMITS_PER_CLAIM_WALLET,
|
|
10
9
|
NoPathParametersSchema,
|
|
10
|
+
OrderPathParametersSchema,
|
|
11
11
|
PostIntegratorMetadataRequestBodySchema,
|
|
12
12
|
PostTixIndexerIntegratorMetadataResultSchema,
|
|
13
13
|
SignTenantTransactionRequestBodySchema,
|
|
14
14
|
SignTransactionResponseSchema,
|
|
15
15
|
SubmitTenantTransactionRequestBodySchema,
|
|
16
16
|
SubmitTenantTransactionResponseSchema,
|
|
17
|
-
|
|
17
|
+
TransactionPathParametersSchema,
|
|
18
18
|
WalletPathParametersSchema,
|
|
19
19
|
defineClientRoute,
|
|
20
|
-
requireUniquePermitKeys,
|
|
21
20
|
solanaDataApiClientRoutes,
|
|
22
21
|
tixIndexerReadApiClientRoutes
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MZKCWS5T.js";
|
|
24
23
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
TdpApiError,
|
|
25
|
+
TdpResponseValidationError
|
|
26
|
+
} from "./chunk-7IWD2KHF.js";
|
|
27
|
+
|
|
28
|
+
// src/utils/usdc-cents.ts
|
|
29
|
+
var USDC_DECIMALS = 6;
|
|
30
|
+
var USDC_MINOR_PER_CENT = 10n ** BigInt(USDC_DECIMALS - 2);
|
|
31
|
+
function usdcMinorToCents(usdcMinor) {
|
|
32
|
+
return (usdcMinor + USDC_MINOR_PER_CENT / 2n) / USDC_MINOR_PER_CENT;
|
|
33
|
+
}
|
|
34
|
+
function centsToUsdcMinor(cents) {
|
|
35
|
+
return cents * USDC_MINOR_PER_CENT;
|
|
36
|
+
}
|
|
37
|
+
function convertWireUsdcMinorToCents(usdcMinor) {
|
|
38
|
+
return Number(usdcMinorToCents(BigInt(usdcMinor)));
|
|
39
|
+
}
|
|
27
40
|
|
|
28
41
|
// src/solana-data-api/create-solana-client.ts
|
|
29
42
|
function createSolanaClient(tixApi) {
|
|
30
43
|
return {
|
|
31
|
-
getEvent(pathParams, options) {
|
|
32
|
-
|
|
44
|
+
async getEvent(pathParams, options) {
|
|
45
|
+
const { min_royalty_floor, ...event } = await tixApi(
|
|
33
46
|
{
|
|
34
47
|
route: "get-event-account",
|
|
35
48
|
pathParams
|
|
36
49
|
},
|
|
37
50
|
options
|
|
38
51
|
);
|
|
52
|
+
return {
|
|
53
|
+
...event,
|
|
54
|
+
min_royalty_floor_cents: convertWireUsdcMinorToCents(min_royalty_floor)
|
|
55
|
+
};
|
|
39
56
|
},
|
|
40
|
-
getListing(pathParams, options) {
|
|
41
|
-
|
|
57
|
+
async getListing(pathParams, options) {
|
|
58
|
+
const { ask_price_minor, ...listing } = await tixApi(
|
|
42
59
|
{
|
|
43
60
|
route: "get-listing-account",
|
|
44
61
|
pathParams
|
|
45
62
|
},
|
|
46
63
|
options
|
|
47
64
|
);
|
|
65
|
+
return {
|
|
66
|
+
...listing,
|
|
67
|
+
ask_price_cents: convertWireUsdcMinorToCents(ask_price_minor)
|
|
68
|
+
};
|
|
48
69
|
},
|
|
49
70
|
getPermit(pathParams, options) {
|
|
50
71
|
return tixApi(
|
|
@@ -55,22 +76,47 @@ function createSolanaClient(tixApi) {
|
|
|
55
76
|
options
|
|
56
77
|
);
|
|
57
78
|
},
|
|
58
|
-
getProtocolConfig(options) {
|
|
59
|
-
|
|
79
|
+
async getProtocolConfig(options) {
|
|
80
|
+
const {
|
|
81
|
+
event_registration_fee_minor,
|
|
82
|
+
permit_fee_minor,
|
|
83
|
+
p2p_transfer_fee_minor,
|
|
84
|
+
...protocolConfig
|
|
85
|
+
} = await tixApi(
|
|
60
86
|
{
|
|
61
87
|
route: "get-protocol-config-account"
|
|
62
88
|
},
|
|
63
89
|
options
|
|
64
90
|
);
|
|
91
|
+
return {
|
|
92
|
+
...protocolConfig,
|
|
93
|
+
event_registration_fee_cents: convertWireUsdcMinorToCents(
|
|
94
|
+
event_registration_fee_minor
|
|
95
|
+
),
|
|
96
|
+
permit_fee_cents: convertWireUsdcMinorToCents(permit_fee_minor),
|
|
97
|
+
p2p_transfer_fee_cents: convertWireUsdcMinorToCents(
|
|
98
|
+
p2p_transfer_fee_minor
|
|
99
|
+
)
|
|
100
|
+
};
|
|
65
101
|
},
|
|
66
|
-
getIntegrator(pathParams, options) {
|
|
67
|
-
|
|
102
|
+
async getIntegrator(pathParams, options) {
|
|
103
|
+
const { integrator, ...account } = await tixApi(
|
|
68
104
|
{
|
|
69
105
|
route: "get-integrator-account",
|
|
70
106
|
pathParams
|
|
71
107
|
},
|
|
72
108
|
options
|
|
73
109
|
);
|
|
110
|
+
const { balance, ...registration } = integrator;
|
|
111
|
+
return {
|
|
112
|
+
...account,
|
|
113
|
+
integrator: {
|
|
114
|
+
...registration,
|
|
115
|
+
balance: {
|
|
116
|
+
amount_cents: convertWireUsdcMinorToCents(balance.amount_minor)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
74
120
|
}
|
|
75
121
|
};
|
|
76
122
|
}
|
|
@@ -96,6 +142,14 @@ var responseBodySchemaByRouteKey2 = Object.fromEntries(
|
|
|
96
142
|
)
|
|
97
143
|
);
|
|
98
144
|
|
|
145
|
+
// src/routes/create-tdp-api-error-from-route-failure.ts
|
|
146
|
+
function createTdpApiErrorFromRouteFailure(failure) {
|
|
147
|
+
return failure.kind === "response-validation" ? new TdpResponseValidationError(failure) : new TdpApiError(failure);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/routes/execute-client-route.ts
|
|
151
|
+
import { z } from "zod";
|
|
152
|
+
|
|
99
153
|
// src/utils/join-url-segments.ts
|
|
100
154
|
function joinUrlSegments(baseUrl, path) {
|
|
101
155
|
return `${baseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
@@ -113,6 +167,10 @@ async function readResponsePayload(response) {
|
|
|
113
167
|
}
|
|
114
168
|
|
|
115
169
|
// src/routes/execute-client-route.ts
|
|
170
|
+
var ErrorResponseBodySchema = z.looseObject({
|
|
171
|
+
message: z.string(),
|
|
172
|
+
code: z.string()
|
|
173
|
+
});
|
|
116
174
|
async function executeClientRoute({
|
|
117
175
|
baseApiUrl,
|
|
118
176
|
fetchImpl,
|
|
@@ -147,9 +205,16 @@ async function executeClientRoute({
|
|
|
147
205
|
path,
|
|
148
206
|
status: response.status,
|
|
149
207
|
statusText: response.statusText,
|
|
150
|
-
payload
|
|
208
|
+
payload,
|
|
209
|
+
requestId: response.headers.get("apigw-requestid") ?? void 0
|
|
151
210
|
};
|
|
152
|
-
if (!response.ok)
|
|
211
|
+
if (!response.ok) {
|
|
212
|
+
throw createError({
|
|
213
|
+
kind: "http-status",
|
|
214
|
+
...failure,
|
|
215
|
+
code: ErrorResponseBodySchema.pick({ code: true }).safeParse(payload).data?.code
|
|
216
|
+
});
|
|
217
|
+
}
|
|
153
218
|
const parsed = route.responseBodySchema.safeParse(payload);
|
|
154
219
|
if (!parsed.success) {
|
|
155
220
|
throw createError({
|
|
@@ -163,7 +228,6 @@ async function executeClientRoute({
|
|
|
163
228
|
|
|
164
229
|
// src/tix-api/create-tix-api-client.ts
|
|
165
230
|
var SOLANA_DATA_API_PATH_PREFIX = "solana";
|
|
166
|
-
var TIX_INDEXER_API_PATH_PREFIX = "tix-indexer";
|
|
167
231
|
function createTixApiClientForRoutes({
|
|
168
232
|
routes,
|
|
169
233
|
baseApiUrl,
|
|
@@ -178,9 +242,9 @@ function createTixApiClientForRoutes({
|
|
|
178
242
|
queryParams,
|
|
179
243
|
body
|
|
180
244
|
}, { signal } = {}) {
|
|
181
|
-
const prefix = route in solanaDataApiClientRoutes ? SOLANA_DATA_API_PATH_PREFIX :
|
|
245
|
+
const prefix = route in solanaDataApiClientRoutes ? `/${SOLANA_DATA_API_PATH_PREFIX}` : "";
|
|
182
246
|
return executeClientRoute({
|
|
183
|
-
baseApiUrl: `${baseApiUrl}
|
|
247
|
+
baseApiUrl: `${baseApiUrl}${prefix}`,
|
|
184
248
|
fetchImpl,
|
|
185
249
|
headers,
|
|
186
250
|
signal,
|
|
@@ -193,7 +257,7 @@ function createTixApiClientForRoutes({
|
|
|
193
257
|
"x-api-key": typeof apiKey === "string" ? apiKey : await apiKey(),
|
|
194
258
|
...additionalHeaders
|
|
195
259
|
},
|
|
196
|
-
createError:
|
|
260
|
+
createError: createTdpApiErrorFromRouteFailure
|
|
197
261
|
});
|
|
198
262
|
};
|
|
199
263
|
}
|
|
@@ -218,17 +282,48 @@ function createTixApiClient({
|
|
|
218
282
|
});
|
|
219
283
|
}
|
|
220
284
|
|
|
285
|
+
// src/tix-indexer-api/create-events-client.ts
|
|
286
|
+
function createEventsClient(tixApi) {
|
|
287
|
+
return {
|
|
288
|
+
list(queryParams = {}, options) {
|
|
289
|
+
return tixApi(
|
|
290
|
+
{
|
|
291
|
+
route: "get-events",
|
|
292
|
+
queryParams
|
|
293
|
+
},
|
|
294
|
+
options
|
|
295
|
+
);
|
|
296
|
+
},
|
|
297
|
+
get(pathParams, options) {
|
|
298
|
+
return tixApi(
|
|
299
|
+
{
|
|
300
|
+
route: "get-event",
|
|
301
|
+
pathParams
|
|
302
|
+
},
|
|
303
|
+
options
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
221
309
|
// src/tix-indexer-api/create-indexer-client.ts
|
|
222
310
|
function createIndexerClient(tixApi) {
|
|
223
311
|
return {
|
|
224
|
-
listActiveListings(queryParams
|
|
225
|
-
|
|
312
|
+
async listActiveListings(queryParams, options) {
|
|
313
|
+
const { items, next_cursor } = await tixApi(
|
|
226
314
|
{
|
|
227
315
|
route: "get-active-listings",
|
|
228
316
|
queryParams
|
|
229
317
|
},
|
|
230
318
|
options
|
|
231
319
|
);
|
|
320
|
+
return {
|
|
321
|
+
items: items.map(({ ask_price_minor, ...listing }) => ({
|
|
322
|
+
...listing,
|
|
323
|
+
ask_price_cents: ask_price_minor === null ? null : convertWireUsdcMinorToCents(ask_price_minor)
|
|
324
|
+
})),
|
|
325
|
+
next_cursor
|
|
326
|
+
};
|
|
232
327
|
},
|
|
233
328
|
listUpcomingEvents(queryParams = {}, options) {
|
|
234
329
|
return tixApi(
|
|
@@ -255,14 +350,29 @@ function createIndexerClient(tixApi) {
|
|
|
255
350
|
};
|
|
256
351
|
}
|
|
257
352
|
|
|
353
|
+
// src/tix-indexer-api/create-integrator-client.ts
|
|
354
|
+
function createIntegratorClient(tixApi) {
|
|
355
|
+
return {
|
|
356
|
+
getInfo(options) {
|
|
357
|
+
return tixApi(
|
|
358
|
+
{
|
|
359
|
+
route: "get-integrator"
|
|
360
|
+
},
|
|
361
|
+
options
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
258
367
|
// ../tdp-schemas/src/wallet-custody/api-key-route-keys.ts
|
|
259
368
|
var GET_USER_ADDRESS_ROUTE_KEY = "GET /wallets/users/{subject}/address";
|
|
260
369
|
var GET_INTEGRATOR_ADDRESS_ROUTE_KEY = "GET /wallets/integrators/{subject}/address";
|
|
261
370
|
var SIGN_USER_TRANSACTION_ROUTE_KEY = "POST /wallets/users/{subject}/signatures";
|
|
262
371
|
var SIGN_INTEGRATOR_TRANSACTION_ROUTE_KEY = "POST /wallets/integrators/{subject}/signatures";
|
|
263
372
|
var SUBMIT_TENANT_TRANSACTION_ROUTE_KEY = "POST /transactions/submissions";
|
|
264
|
-
var
|
|
265
|
-
var
|
|
373
|
+
var GET_TRANSACTION_ROUTE_KEY = "GET /transactions/{id}";
|
|
374
|
+
var CREATE_AND_SUBMIT_ORDER_ROUTE_KEY = "POST /orders";
|
|
375
|
+
var GET_ORDER_ROUTE_KEY = "GET /orders/{id}";
|
|
266
376
|
var GET_FEE_PAYER_ADDRESS_ROUTE_KEY = "GET /wallets/fee-payer/address";
|
|
267
377
|
var GET_PROTOCOL_AUTHORITY_ADDRESS_ROUTE_KEY = "GET /wallets/protocol-authority/address";
|
|
268
378
|
|
|
@@ -316,24 +426,33 @@ var apiKeyWalletCustodyApiClientRoutes = {
|
|
|
316
426
|
requestBodySchema: SubmitTenantTransactionRequestBodySchema,
|
|
317
427
|
responseBodySchema: SubmitTenantTransactionResponseSchema
|
|
318
428
|
}),
|
|
319
|
-
"get-
|
|
320
|
-
name: "get-
|
|
429
|
+
"get-transaction": defineClientRoute({
|
|
430
|
+
name: "get-transaction",
|
|
321
431
|
method: "GET",
|
|
322
|
-
routeKey:
|
|
323
|
-
pathParamsSchema:
|
|
324
|
-
buildPath: ({ baseApiUrl = "" }) => `${baseApiUrl}/
|
|
325
|
-
headersSchema:
|
|
326
|
-
responseBodySchema:
|
|
432
|
+
routeKey: GET_TRANSACTION_ROUTE_KEY,
|
|
433
|
+
pathParamsSchema: TransactionPathParametersSchema,
|
|
434
|
+
buildPath: ({ baseApiUrl = "", id }) => `${baseApiUrl}/transactions/${id}`,
|
|
435
|
+
headersSchema: ApiKeyHeadersSchema,
|
|
436
|
+
responseBodySchema: SubmitTenantTransactionResponseSchema
|
|
437
|
+
}),
|
|
438
|
+
"get-order": defineClientRoute({
|
|
439
|
+
name: "get-order",
|
|
440
|
+
method: "GET",
|
|
441
|
+
routeKey: GET_ORDER_ROUTE_KEY,
|
|
442
|
+
pathParamsSchema: OrderPathParametersSchema,
|
|
443
|
+
buildPath: ({ baseApiUrl = "", id }) => `${baseApiUrl}/orders/${encodeURIComponent(id)}`,
|
|
444
|
+
headersSchema: ApiKeyHeadersSchema,
|
|
445
|
+
responseBodySchema: GetOrderResponseSchema
|
|
327
446
|
}),
|
|
328
|
-
"
|
|
329
|
-
name: "
|
|
447
|
+
"create-and-submit-order": defineClientRoute({
|
|
448
|
+
name: "create-and-submit-order",
|
|
330
449
|
method: "POST",
|
|
331
|
-
routeKey:
|
|
450
|
+
routeKey: CREATE_AND_SUBMIT_ORDER_ROUTE_KEY,
|
|
332
451
|
pathParamsSchema: NoPathParametersSchema,
|
|
333
|
-
buildPath: ({ baseApiUrl = "" }) => `${baseApiUrl}/
|
|
452
|
+
buildPath: ({ baseApiUrl = "" }) => `${baseApiUrl}/orders`,
|
|
334
453
|
headersSchema: IdempotencyKeyAndApiKeyHeadersSchema,
|
|
335
|
-
requestBodySchema:
|
|
336
|
-
responseBodySchema:
|
|
454
|
+
requestBodySchema: CreateAndSubmitOrderRequestBodySchema,
|
|
455
|
+
responseBodySchema: CreateAndSubmitOrderResponseSchema
|
|
337
456
|
}),
|
|
338
457
|
"get-fee-payer-address": defineClientRoute({
|
|
339
458
|
name: "get-fee-payer-address",
|
|
@@ -359,7 +478,7 @@ var apiKeyWalletCustodyApiClientRoutes = {
|
|
|
359
478
|
function executeWalletCustodyRoute(request) {
|
|
360
479
|
return executeClientRoute({
|
|
361
480
|
...request,
|
|
362
|
-
createError:
|
|
481
|
+
createError: createTdpApiErrorFromRouteFailure
|
|
363
482
|
});
|
|
364
483
|
}
|
|
365
484
|
|
|
@@ -393,88 +512,34 @@ function createWalletCustodyApiClient({
|
|
|
393
512
|
};
|
|
394
513
|
}
|
|
395
514
|
|
|
396
|
-
// src/wallet-custody/create-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// src/wallet-custody/resolve-claim-offer.ts
|
|
400
|
-
async function resolveClaimOffer(solana, ticket, protocol, eventResponse, options) {
|
|
401
|
-
const [listing, event, permit] = await Promise.all([
|
|
402
|
-
solana.getListing(ticket, options),
|
|
403
|
-
eventResponse,
|
|
404
|
-
solana.getPermit(ticket, options)
|
|
405
|
-
]);
|
|
406
|
-
return {
|
|
407
|
-
event_id: listing.event_id,
|
|
408
|
-
ticket_id: listing.ticket_id,
|
|
409
|
-
permit_version: listing.permit_version,
|
|
410
|
-
seller_payout: listing.payout_ata,
|
|
411
|
-
royalty_destinations: event.royalty_recipients_count > 0 ? event.royalty_recipients.slice(0, event.royalty_recipients_count).map(({ destination }) => destination) : [protocol.default_royalty_vault],
|
|
412
|
-
ticket_type_config: permit.ticket_type_config,
|
|
413
|
-
usdc_mint: protocol.usdc_mint
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// src/wallet-custody/create-claim-wallets-client.ts
|
|
418
|
-
var AcceptOffersBodySchema = AcceptClaimOffersRequestBodySchema.extend({
|
|
419
|
-
offers: z.array(TicketPathParametersSchema).min(1).max(MAX_PERMITS_PER_CLAIM_WALLET).superRefine(requireUniquePermitKeys)
|
|
420
|
-
});
|
|
421
|
-
function createClaimWalletsClient(walletCustodyApi, solana) {
|
|
515
|
+
// src/wallet-custody/create-orders-client.ts
|
|
516
|
+
function createOrdersClient(walletCustodyApi) {
|
|
422
517
|
return {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}, options) {
|
|
426
|
-
return walletCustodyApi(
|
|
427
|
-
{ route: "get-purchase-status", idempotencyKey },
|
|
428
|
-
options
|
|
429
|
-
);
|
|
430
|
-
},
|
|
431
|
-
async acceptOffers({
|
|
518
|
+
/** Creates the order and submits its purchase in the same call. */
|
|
519
|
+
createAndSubmit({
|
|
432
520
|
idempotencyKey,
|
|
433
521
|
body
|
|
434
522
|
}, options) {
|
|
435
|
-
const parsedBody = AcceptOffersBodySchema.parse(body);
|
|
436
|
-
const protocol = await solana.getProtocolConfig(options);
|
|
437
|
-
const events = /* @__PURE__ */ new Map();
|
|
438
|
-
const offers = await Promise.all(
|
|
439
|
-
parsedBody.offers.map((ticket) => {
|
|
440
|
-
const eventId = String(ticket.eventId);
|
|
441
|
-
const event = events.get(eventId) ?? solana.getEvent({ eventId }, options);
|
|
442
|
-
events.set(eventId, event);
|
|
443
|
-
return resolveClaimOffer(solana, ticket, protocol, event, options);
|
|
444
|
-
})
|
|
445
|
-
);
|
|
446
523
|
return walletCustodyApi(
|
|
447
|
-
{
|
|
448
|
-
route: "accept-claim-offers",
|
|
449
|
-
body: { ...parsedBody, offers },
|
|
450
|
-
idempotencyKey
|
|
451
|
-
},
|
|
524
|
+
{ route: "create-and-submit-order", body, idempotencyKey },
|
|
452
525
|
options
|
|
453
526
|
);
|
|
527
|
+
},
|
|
528
|
+
get(pathParams, options) {
|
|
529
|
+
return walletCustodyApi({ route: "get-order", pathParams }, options);
|
|
454
530
|
}
|
|
455
531
|
};
|
|
456
532
|
}
|
|
457
533
|
|
|
534
|
+
// src/wallet-custody/const.ts
|
|
535
|
+
var INTEGRATOR_PRIMARY_ADDRESS_SUBJECT = "PRIMARY_ADDRESS";
|
|
536
|
+
|
|
458
537
|
// src/wallet-custody/create-transactions-client.ts
|
|
459
538
|
function createTransactionsClient(walletCustodyApi) {
|
|
460
539
|
return {
|
|
461
|
-
|
|
462
|
-
subject,
|
|
463
|
-
idempotencyKey,
|
|
464
|
-
body
|
|
465
|
-
}, options) {
|
|
466
|
-
return walletCustodyApi(
|
|
467
|
-
{
|
|
468
|
-
route: "sign-user-transaction",
|
|
469
|
-
pathParams: { subject },
|
|
470
|
-
body,
|
|
471
|
-
idempotencyKey
|
|
472
|
-
},
|
|
473
|
-
options
|
|
474
|
-
);
|
|
475
|
-
},
|
|
540
|
+
/** A `subject` is not necessary. */
|
|
476
541
|
signIntegrator({
|
|
477
|
-
subject,
|
|
542
|
+
subject = INTEGRATOR_PRIMARY_ADDRESS_SUBJECT,
|
|
478
543
|
idempotencyKey,
|
|
479
544
|
body
|
|
480
545
|
}, options) {
|
|
@@ -514,11 +579,14 @@ function createWalletClient(walletCustodyApi) {
|
|
|
514
579
|
options
|
|
515
580
|
);
|
|
516
581
|
},
|
|
517
|
-
|
|
582
|
+
/** A `subject` is not necessary. */
|
|
583
|
+
getIntegratorAddress({
|
|
584
|
+
subject = INTEGRATOR_PRIMARY_ADDRESS_SUBJECT
|
|
585
|
+
} = {}, options) {
|
|
518
586
|
return walletCustodyApi(
|
|
519
587
|
{
|
|
520
588
|
route: "get-integrator-address",
|
|
521
|
-
pathParams
|
|
589
|
+
pathParams: { subject }
|
|
522
590
|
},
|
|
523
591
|
options
|
|
524
592
|
);
|
|
@@ -549,10 +617,13 @@ function createTdpClient(options) {
|
|
|
549
617
|
const solana = createSolanaClient(tixApi);
|
|
550
618
|
return {
|
|
551
619
|
solana,
|
|
620
|
+
events: createEventsClient(tixApi),
|
|
552
621
|
indexer: createIndexerClient(tixApi),
|
|
622
|
+
integrator: createIntegratorClient(tixApi),
|
|
553
623
|
wallets: createWalletClient(walletCustodyApi),
|
|
554
624
|
transactions: createTransactionsClient(walletCustodyApi),
|
|
555
|
-
|
|
625
|
+
orders: createOrdersClient(walletCustodyApi),
|
|
626
|
+
utils: { usdcMinorToCents, centsToUsdcMinor }
|
|
556
627
|
};
|
|
557
628
|
}
|
|
558
629
|
export {
|