@imtbl/sdk 1.36.2 → 1.36.3-alpha.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/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
+ import { Pool } from 'pg';
3
+
2
4
  declare enum Environment {
3
5
  PRODUCTION = "production",
4
6
  SANDBOX = "sandbox"
@@ -7841,7 +7843,7 @@ interface MintUser$1 {
7841
7843
  * @export
7842
7844
  * @interface MintRequest
7843
7845
  */
7844
- interface MintRequest$1 {
7846
+ interface MintRequest$2 {
7845
7847
  /**
7846
7848
  * Signature from authorised minter
7847
7849
  * @type {string}
@@ -10820,7 +10822,7 @@ interface MintsApiMintTokensRequest$1 {
10820
10822
  * @type {Array<MintRequest>}
10821
10823
  * @memberof MintsApiMintTokens
10822
10824
  */
10823
- readonly mintTokensRequestV2: Array<MintRequest$1>;
10825
+ readonly mintTokensRequestV2: Array<MintRequest$2>;
10824
10826
  }
10825
10827
  /**
10826
10828
  * MintsApi - object-oriented interface
@@ -21026,7 +21028,7 @@ type UnsignedTransferRequest = TokenAmount & {
21026
21028
  /**
21027
21029
  * Parameter required to Mint tokens
21028
21030
  */
21029
- type UnsignedMintRequest = Omit<MintRequest$1, 'auth_signature'>;
21031
+ type UnsignedMintRequest = Omit<MintRequest$2, 'auth_signature'>;
21030
21032
  /**
21031
21033
  * Parameter required to create a Transfer
21032
21034
  */
@@ -21184,7 +21186,7 @@ interface MetadataSchemaRequest extends MetadataSchemaRequest$1 {
21184
21186
  }
21185
21187
  interface MintFee extends MintFee$1 {
21186
21188
  }
21187
- interface MintRequest extends MintRequest$1 {
21189
+ interface MintRequest$1 extends MintRequest$2 {
21188
21190
  }
21189
21191
  interface MintTokenDataV2 extends MintTokenDataV2$1 {
21190
21192
  }
@@ -29150,7 +29152,6 @@ declare const x_d_MetadataRefreshesApi: typeof MetadataRefreshesApi;
29150
29152
  type x_d_MetadataSchemaRequest = MetadataSchemaRequest;
29151
29153
  declare const x_d_MetadataSchemaRequestTypeEnum: typeof MetadataSchemaRequestTypeEnum;
29152
29154
  type x_d_MintFee = MintFee;
29153
- type x_d_MintRequest = MintRequest;
29154
29155
  type x_d_MintTokenDataV2 = MintTokenDataV2;
29155
29156
  type x_d_MintTokensResponse = MintTokensResponse;
29156
29157
  type x_d_MintUser = MintUser;
@@ -29293,7 +29294,7 @@ declare namespace x_d {
29293
29294
  x_d_MetadataSchemaRequest as MetadataSchemaRequest,
29294
29295
  x_d_MetadataSchemaRequestTypeEnum as MetadataSchemaRequestTypeEnum,
29295
29296
  x_d_MintFee as MintFee,
29296
- x_d_MintRequest as MintRequest,
29297
+ MintRequest$1 as MintRequest,
29297
29298
  x_d_MintTokenDataV2 as MintTokenDataV2,
29298
29299
  x_d_MintTokensResponse as MintTokensResponse,
29299
29300
  x_d_MintUser as MintUser,
@@ -29357,4 +29358,135 @@ declare namespace x_d {
29357
29358
  };
29358
29359
  }
29359
29360
 
29360
- export { blockchain_data_d as blockchainData, checkout_d as checkout, config_d as config, orderbook_d as orderbook, passport_d as passport, x_d as x };
29361
+ declare const init: (body: string | Record<string, unknown>, env: Environment, handlers: {
29362
+ zkevmMintRequestUpdated: (event: any) => Promise<void>;
29363
+ others?: ((event: any) => Promise<void>) | undefined;
29364
+ }) => Promise<void>;
29365
+
29366
+ declare const webhook_d_init: typeof init;
29367
+ declare namespace webhook_d {
29368
+ export {
29369
+ webhook_d_init as init,
29370
+ };
29371
+ }
29372
+
29373
+ type CreateMintRequest = {
29374
+ contract_address: string;
29375
+ asset_id: string;
29376
+ metadata: any;
29377
+ owner_address: string;
29378
+ };
29379
+ type MintRequest = {
29380
+ id: string;
29381
+ contract_address: string;
29382
+ wallet_address: string;
29383
+ asset_id: string;
29384
+ metadata: any;
29385
+ owner_address: string;
29386
+ tried_count: number;
29387
+ };
29388
+ type SubmittedMintRequest = {
29389
+ tokenId: string | null;
29390
+ status: string;
29391
+ assetId: string;
29392
+ contractAddress: string;
29393
+ ownerAddress: string;
29394
+ metadataId: string;
29395
+ imtblZkevmMintRequestUpdatedId: string;
29396
+ error: any | null;
29397
+ };
29398
+ interface MintingPersistence {
29399
+ recordMint: (request: CreateMintRequest) => Promise<void>;
29400
+ getNextBatchForSubmission: (limit: number) => Promise<MintRequest[]>;
29401
+ updateMintingStatusToSubmitted: (ids: string[]) => Promise<void>;
29402
+ updateMintingStatusToSubmissionFailed: (ids: string[]) => Promise<void>;
29403
+ syncMintingStatus: (submittedMintRequest: SubmittedMintRequest) => Promise<void>;
29404
+ markAsConflict: (assetIds: string[], contractAddress: string) => Promise<void>;
29405
+ resetMintingStatus: (ids: string[]) => Promise<void>;
29406
+ markForRetry: (ids: string[]) => Promise<void>;
29407
+ getMintingRequest: (contractAddress: string, referenceId: string) => Promise<MintRequest | null>;
29408
+ }
29409
+
29410
+ declare const mintingPersistence$1: (client: Pool) => MintingPersistence;
29411
+
29412
+ declare const mintingPersistence: (client: any) => MintingPersistence;
29413
+
29414
+ interface Logger {
29415
+ info: (message: string) => void;
29416
+ error: (message: any) => void;
29417
+ }
29418
+
29419
+ declare const recordMint: (mintingPersistence: MintingPersistence, mintRequest: CreateMintRequest) => Promise<void>;
29420
+ declare const submitMintingRequests: (mintingPersistence: MintingPersistence, blockchainDataSDKClient: BlockchainData, { defaultBatchSize, chainName, maxNumberOfTries, }: {
29421
+ defaultBatchSize?: number | undefined;
29422
+ chainName?: string | undefined;
29423
+ maxNumberOfTries?: number | undefined;
29424
+ }, logger?: Logger) => Promise<never>;
29425
+ type MintRequestEvent = {
29426
+ event_name: string;
29427
+ chain: string;
29428
+ event_id: string;
29429
+ data: {
29430
+ chain: {
29431
+ id: string;
29432
+ name: string;
29433
+ };
29434
+ contract_address: string;
29435
+ owner_address: string;
29436
+ reference_id: string;
29437
+ metadata_id: string;
29438
+ token_id: string | null;
29439
+ status: string;
29440
+ transaction_hash: string | null;
29441
+ activity_id: string | null;
29442
+ error: {
29443
+ code: string;
29444
+ message: string;
29445
+ } | null;
29446
+ created_at: string;
29447
+ updated_at: string;
29448
+ };
29449
+ };
29450
+ declare const processMint: (mintingPersistence: MintingPersistence, event: MintRequestEvent, logger?: Logger) => Promise<void>;
29451
+
29452
+ interface MintingBackendModuleConfiguration extends ModuleConfiguration<undefined> {
29453
+ persistence: MintingPersistence;
29454
+ logger?: Logger;
29455
+ }
29456
+ declare class MintingBackendModule {
29457
+ private readonly baseConfig;
29458
+ private readonly persistence;
29459
+ private readonly blockchainDataClient;
29460
+ private readonly logger;
29461
+ constructor(config: MintingBackendModuleConfiguration);
29462
+ recordMint(mintRequest: CreateMintRequest): Promise<void>;
29463
+ submitMintingRequests(config: {
29464
+ defaultBatchSize?: number;
29465
+ chainName?: string;
29466
+ maxNumberOfTries?: number;
29467
+ }): Promise<void>;
29468
+ processMint(body: string | Record<string, unknown>, otherHandlers?: {
29469
+ zkevmMintRequestUpdated: (event: MintRequestEvent) => Promise<void>;
29470
+ others: (..._args: any) => Promise<void>;
29471
+ }): Promise<void>;
29472
+ }
29473
+
29474
+ type minting_backend_d_MintingBackendModule = MintingBackendModule;
29475
+ declare const minting_backend_d_MintingBackendModule: typeof MintingBackendModule;
29476
+ type minting_backend_d_MintingBackendModuleConfiguration = MintingBackendModuleConfiguration;
29477
+ declare const minting_backend_d_processMint: typeof processMint;
29478
+ declare const minting_backend_d_recordMint: typeof recordMint;
29479
+ declare const minting_backend_d_submitMintingRequests: typeof submitMintingRequests;
29480
+ declare namespace minting_backend_d {
29481
+ export {
29482
+ minting_backend_d_MintingBackendModule as MintingBackendModule,
29483
+ minting_backend_d_MintingBackendModuleConfiguration as MintingBackendModuleConfiguration,
29484
+ mintingPersistence$1 as mintingPersistencePg,
29485
+ mintingPersistence as mintingPersistencePrismaSqlite,
29486
+ minting_backend_d_processMint as processMint,
29487
+ minting_backend_d_recordMint as recordMint,
29488
+ minting_backend_d_submitMintingRequests as submitMintingRequests,
29489
+ };
29490
+ }
29491
+
29492
+ export { blockchain_data_d as blockchainData, checkout_d as checkout, config_d as config, minting_backend_d as mintingBackend, orderbook_d as orderbook, passport_d as passport, webhook_d as webhook, x_d as x };