@imtbl/sdk 1.39.2 → 1.39.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
@@ -21033,7 +21035,7 @@ type UnsignedTransferRequest = TokenAmount & {
21033
21035
  /**
21034
21036
  * Parameter required to Mint tokens
21035
21037
  */
21036
- type UnsignedMintRequest = Omit<MintRequest$1, 'auth_signature'>;
21038
+ type UnsignedMintRequest = Omit<MintRequest$2, 'auth_signature'>;
21037
21039
  /**
21038
21040
  * Parameter required to create a Transfer
21039
21041
  */
@@ -21191,7 +21193,7 @@ interface MetadataSchemaRequest extends MetadataSchemaRequest$1 {
21191
21193
  }
21192
21194
  interface MintFee extends MintFee$1 {
21193
21195
  }
21194
- interface MintRequest extends MintRequest$1 {
21196
+ interface MintRequest$1 extends MintRequest$2 {
21195
21197
  }
21196
21198
  interface MintTokenDataV2 extends MintTokenDataV2$1 {
21197
21199
  }
@@ -31837,7 +31839,6 @@ declare const x_d_MetadataRefreshesApi: typeof MetadataRefreshesApi;
31837
31839
  type x_d_MetadataSchemaRequest = MetadataSchemaRequest;
31838
31840
  declare const x_d_MetadataSchemaRequestTypeEnum: typeof MetadataSchemaRequestTypeEnum;
31839
31841
  type x_d_MintFee = MintFee;
31840
- type x_d_MintRequest = MintRequest;
31841
31842
  type x_d_MintTokenDataV2 = MintTokenDataV2;
31842
31843
  type x_d_MintTokensResponse = MintTokensResponse;
31843
31844
  type x_d_MintUser = MintUser;
@@ -31983,7 +31984,7 @@ declare namespace x_d {
31983
31984
  x_d_MetadataSchemaRequest as MetadataSchemaRequest,
31984
31985
  x_d_MetadataSchemaRequestTypeEnum as MetadataSchemaRequestTypeEnum,
31985
31986
  x_d_MintFee as MintFee,
31986
- x_d_MintRequest as MintRequest,
31987
+ MintRequest$1 as MintRequest,
31987
31988
  x_d_MintTokenDataV2 as MintTokenDataV2,
31988
31989
  x_d_MintTokensResponse as MintTokensResponse,
31989
31990
  x_d_MintUser as MintUser,
@@ -32050,4 +32051,141 @@ declare namespace x_d {
32050
32051
  };
32051
32052
  }
32052
32053
 
32053
- 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 };
32054
+ declare const init: (body: string | Record<string, unknown>, env: Environment, handlers: {
32055
+ zkevmMintRequestUpdated: (event: any) => Promise<void>;
32056
+ others?: ((event: any) => Promise<void>) | undefined;
32057
+ }) => Promise<void>;
32058
+
32059
+ declare const webhook_d_init: typeof init;
32060
+ declare namespace webhook_d {
32061
+ export {
32062
+ webhook_d_init as init,
32063
+ };
32064
+ }
32065
+
32066
+ type CreateMintRequest = {
32067
+ contract_address: string;
32068
+ asset_id: string;
32069
+ metadata: any;
32070
+ owner_address: string;
32071
+ amount?: number;
32072
+ token_id?: string;
32073
+ };
32074
+ type MintRequest = {
32075
+ id: string;
32076
+ contract_address: string;
32077
+ wallet_address: string;
32078
+ asset_id: string;
32079
+ metadata: any;
32080
+ owner_address: string;
32081
+ tried_count: number;
32082
+ amount?: number;
32083
+ token_id?: string;
32084
+ };
32085
+ type SubmittedMintRequest = {
32086
+ tokenId: string | null;
32087
+ status: string;
32088
+ assetId: string;
32089
+ contractAddress: string;
32090
+ ownerAddress: string;
32091
+ metadataId: string;
32092
+ imtblZkevmMintRequestUpdatedId: string;
32093
+ error: any | null;
32094
+ amount: number | null;
32095
+ };
32096
+ interface MintingPersistence {
32097
+ recordMint: (request: CreateMintRequest) => Promise<void>;
32098
+ getNextBatchForSubmission: (limit: number) => Promise<MintRequest[]>;
32099
+ updateMintingStatusToSubmitted: (ids: string[]) => Promise<void>;
32100
+ updateMintingStatusToSubmissionFailed: (ids: string[]) => Promise<void>;
32101
+ syncMintingStatus: (submittedMintRequest: SubmittedMintRequest) => Promise<void>;
32102
+ markAsConflict: (assetIds: string[], contractAddress: string) => Promise<void>;
32103
+ resetMintingStatus: (ids: string[]) => Promise<void>;
32104
+ markForRetry: (ids: string[]) => Promise<void>;
32105
+ getMintingRequest: (contractAddress: string, referenceId: string) => Promise<MintRequest | null>;
32106
+ }
32107
+
32108
+ declare const mintingPersistence$1: (client: Pool) => MintingPersistence;
32109
+
32110
+ declare const mintingPersistence: (client: any) => MintingPersistence;
32111
+
32112
+ interface Logger {
32113
+ info: (message: string) => void;
32114
+ error: (message: any) => void;
32115
+ }
32116
+
32117
+ declare const recordMint: (mintingPersistence: MintingPersistence, mintRequest: CreateMintRequest) => Promise<void>;
32118
+ declare const submitMintingRequests: (mintingPersistence: MintingPersistence, blockchainDataSDKClient: BlockchainData, { defaultBatchSize, chainName, maxNumberOfTries, }: {
32119
+ defaultBatchSize?: number | undefined;
32120
+ chainName?: string | undefined;
32121
+ maxNumberOfTries?: number | undefined;
32122
+ }, logger?: Logger) => Promise<never>;
32123
+ type MintRequestEvent = {
32124
+ event_name: string;
32125
+ chain: string;
32126
+ event_id: string;
32127
+ data: {
32128
+ chain: {
32129
+ id: string;
32130
+ name: string;
32131
+ };
32132
+ contract_address: string;
32133
+ owner_address: string;
32134
+ reference_id: string;
32135
+ metadata_id: string;
32136
+ token_id: string | null;
32137
+ status: string;
32138
+ transaction_hash: string | null;
32139
+ activity_id: string | null;
32140
+ error: {
32141
+ code: string;
32142
+ message: string;
32143
+ } | null;
32144
+ created_at: string;
32145
+ updated_at: string;
32146
+ amount?: number;
32147
+ };
32148
+ };
32149
+ declare const processMint: (mintingPersistence: MintingPersistence, event: MintRequestEvent, logger?: Logger) => Promise<void>;
32150
+
32151
+ interface MintingBackendModuleConfiguration extends ModuleConfiguration<undefined> {
32152
+ persistence: MintingPersistence;
32153
+ logger?: Logger;
32154
+ }
32155
+ declare class MintingBackendModule {
32156
+ private readonly baseConfig;
32157
+ private readonly persistence;
32158
+ private readonly blockchainDataClient;
32159
+ private readonly logger;
32160
+ constructor(config: MintingBackendModuleConfiguration);
32161
+ recordMint(mintRequest: CreateMintRequest): Promise<void>;
32162
+ submitMintingRequests(config: {
32163
+ defaultBatchSize?: number;
32164
+ chainName?: string;
32165
+ maxNumberOfTries?: number;
32166
+ }): Promise<void>;
32167
+ processMint(body: string | Record<string, unknown>, otherHandlers?: {
32168
+ zkevmMintRequestUpdated: (event: MintRequestEvent) => Promise<void>;
32169
+ others: (..._args: any) => Promise<void>;
32170
+ }): Promise<void>;
32171
+ }
32172
+
32173
+ type minting_backend_d_MintingBackendModule = MintingBackendModule;
32174
+ declare const minting_backend_d_MintingBackendModule: typeof MintingBackendModule;
32175
+ type minting_backend_d_MintingBackendModuleConfiguration = MintingBackendModuleConfiguration;
32176
+ declare const minting_backend_d_processMint: typeof processMint;
32177
+ declare const minting_backend_d_recordMint: typeof recordMint;
32178
+ declare const minting_backend_d_submitMintingRequests: typeof submitMintingRequests;
32179
+ declare namespace minting_backend_d {
32180
+ export {
32181
+ minting_backend_d_MintingBackendModule as MintingBackendModule,
32182
+ minting_backend_d_MintingBackendModuleConfiguration as MintingBackendModuleConfiguration,
32183
+ mintingPersistence$1 as mintingPersistencePg,
32184
+ mintingPersistence as mintingPersistencePrismaSqlite,
32185
+ minting_backend_d_processMint as processMint,
32186
+ minting_backend_d_recordMint as recordMint,
32187
+ minting_backend_d_submitMintingRequests as submitMintingRequests,
32188
+ };
32189
+ }
32190
+
32191
+ 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 };