@imtbl/sdk 1.40.0-alpha.2 → 1.40.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/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +15 -757
- package/dist/index.d.ts +33 -533
- package/dist/index.js +16 -756
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +4 -4
- package/dist/x.js +3 -3
- package/package.json +1 -9
- package/dist/minting_backend.d.ts +0 -3535
- package/dist/minting_backend.js +0 -6745
- package/dist/webhook.d.ts +0 -1265
- package/dist/webhook.js +0 -486
package/dist/index.js
CHANGED
|
@@ -34,7 +34,6 @@ import { keccak256 as keccak256$3 } from '@ethersproject/solidity';
|
|
|
34
34
|
import { SwapRouter, PaymentsExtended } from '@uniswap/router-sdk';
|
|
35
35
|
import { parseUnits as parseUnits$1 } from '@ethersproject/units';
|
|
36
36
|
import { BigNumber as BigNumber$2 } from '@ethersproject/bignumber';
|
|
37
|
-
import MessageValidator from 'sns-validator';
|
|
38
37
|
|
|
39
38
|
const isNode$1 = () => typeof window === 'undefined';
|
|
40
39
|
const isBrowser$1 = () => !isNode$1();
|
|
@@ -162,7 +161,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
162
161
|
};
|
|
163
162
|
|
|
164
163
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
165
|
-
const SDK_VERSION$1 = '1.40.0
|
|
164
|
+
const SDK_VERSION$1 = '1.40.0';
|
|
166
165
|
const getFrameParentDomain$1 = () => {
|
|
167
166
|
if (isNode$1()) {
|
|
168
167
|
return '';
|
|
@@ -14189,7 +14188,7 @@ class MultiRollupApiClients {
|
|
|
14189
14188
|
}
|
|
14190
14189
|
|
|
14191
14190
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14192
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.40.0
|
|
14191
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.40.0' };
|
|
14193
14192
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
14194
14193
|
if (!basePath.trim()) {
|
|
14195
14194
|
throw Error('basePath can not be empty');
|
|
@@ -14261,7 +14260,7 @@ class APIError extends Error {
|
|
|
14261
14260
|
|
|
14262
14261
|
/* eslint-disable implicit-arrow-linebreak */
|
|
14263
14262
|
const defaultHeaders$1 = {
|
|
14264
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.40.0
|
|
14263
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.40.0',
|
|
14265
14264
|
};
|
|
14266
14265
|
/**
|
|
14267
14266
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14735,7 +14734,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14735
14734
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14736
14735
|
class ApiConfiguration extends index$2.Configuration {
|
|
14737
14736
|
}
|
|
14738
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.40.0
|
|
14737
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.40.0' };
|
|
14739
14738
|
/**
|
|
14740
14739
|
* @dev use createImmutableXConfiguration instead
|
|
14741
14740
|
*/
|
|
@@ -14776,7 +14775,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14776
14775
|
coreContractAddress,
|
|
14777
14776
|
registrationContractAddress,
|
|
14778
14777
|
registrationV4ContractAddress,
|
|
14779
|
-
sdkVersion: 'ts-immutable-sdk-1.40.0
|
|
14778
|
+
sdkVersion: 'ts-immutable-sdk-1.40.0',
|
|
14780
14779
|
baseConfig,
|
|
14781
14780
|
});
|
|
14782
14781
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -26279,12 +26278,12 @@ function assertOptions$1(options, schema, allowUnknown) {
|
|
|
26279
26278
|
}
|
|
26280
26279
|
}
|
|
26281
26280
|
|
|
26282
|
-
var validator$
|
|
26281
|
+
var validator$1 = {
|
|
26283
26282
|
assertOptions: assertOptions$1,
|
|
26284
26283
|
validators: validators$1$1
|
|
26285
26284
|
};
|
|
26286
26285
|
|
|
26287
|
-
const validators$2 = validator$
|
|
26286
|
+
const validators$2 = validator$1.validators;
|
|
26288
26287
|
|
|
26289
26288
|
/**
|
|
26290
26289
|
* Create a new instance of Axios
|
|
@@ -26325,7 +26324,7 @@ let Axios$2 = class Axios {
|
|
|
26325
26324
|
const {transitional, paramsSerializer, headers} = config;
|
|
26326
26325
|
|
|
26327
26326
|
if (transitional !== undefined) {
|
|
26328
|
-
validator$
|
|
26327
|
+
validator$1.assertOptions(transitional, {
|
|
26329
26328
|
silentJSONParsing: validators$2.transitional(validators$2.boolean),
|
|
26330
26329
|
forcedJSONParsing: validators$2.transitional(validators$2.boolean),
|
|
26331
26330
|
clarifyTimeoutError: validators$2.transitional(validators$2.boolean)
|
|
@@ -26338,7 +26337,7 @@ let Axios$2 = class Axios {
|
|
|
26338
26337
|
serialize: paramsSerializer
|
|
26339
26338
|
};
|
|
26340
26339
|
} else {
|
|
26341
|
-
validator$
|
|
26340
|
+
validator$1.assertOptions(paramsSerializer, {
|
|
26342
26341
|
encode: validators$2.function,
|
|
26343
26342
|
serialize: validators$2.function
|
|
26344
26343
|
}, true);
|
|
@@ -35107,12 +35106,12 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
35107
35106
|
}
|
|
35108
35107
|
}
|
|
35109
35108
|
|
|
35110
|
-
var validator
|
|
35109
|
+
var validator = {
|
|
35111
35110
|
assertOptions,
|
|
35112
35111
|
validators: validators$1
|
|
35113
35112
|
};
|
|
35114
35113
|
|
|
35115
|
-
const validators = validator
|
|
35114
|
+
const validators = validator.validators;
|
|
35116
35115
|
|
|
35117
35116
|
/**
|
|
35118
35117
|
* Create a new instance of Axios
|
|
@@ -35153,7 +35152,7 @@ class Axios {
|
|
|
35153
35152
|
const {transitional, paramsSerializer, headers} = config;
|
|
35154
35153
|
|
|
35155
35154
|
if (transitional !== undefined) {
|
|
35156
|
-
validator
|
|
35155
|
+
validator.assertOptions(transitional, {
|
|
35157
35156
|
silentJSONParsing: validators.transitional(validators.boolean),
|
|
35158
35157
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
35159
35158
|
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
@@ -35166,7 +35165,7 @@ class Axios {
|
|
|
35166
35165
|
serialize: paramsSerializer
|
|
35167
35166
|
};
|
|
35168
35167
|
} else {
|
|
35169
|
-
validator
|
|
35168
|
+
validator.assertOptions(paramsSerializer, {
|
|
35170
35169
|
encode: validators.function,
|
|
35171
35170
|
serialize: validators.function
|
|
35172
35171
|
}, true);
|
|
@@ -60925,7 +60924,7 @@ const flattenProperties = (properties) => {
|
|
|
60925
60924
|
};
|
|
60926
60925
|
|
|
60927
60926
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
60928
|
-
const SDK_VERSION = '1.40.0
|
|
60927
|
+
const SDK_VERSION = '1.40.0';
|
|
60929
60928
|
const getFrameParentDomain = () => {
|
|
60930
60929
|
if (isNode()) {
|
|
60931
60930
|
return '';
|
|
@@ -66243,7 +66242,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
66243
66242
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
66244
66243
|
};
|
|
66245
66244
|
|
|
66246
|
-
const SDK_VERSION_MARKER = '1.40.0
|
|
66245
|
+
const SDK_VERSION_MARKER = '1.40.0';
|
|
66247
66246
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
66248
66247
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
66249
66248
|
|
|
@@ -72003,743 +72002,4 @@ var x = /*#__PURE__*/Object.freeze({
|
|
|
72003
72002
|
starkEcOrder: starkEcOrder
|
|
72004
72003
|
});
|
|
72005
72004
|
|
|
72006
|
-
|
|
72007
|
-
const allowedTopicArnPrefix = {
|
|
72008
|
-
[Environment$1.PRODUCTION]: 'arn:aws:sns:us-east-2:362750628221:',
|
|
72009
|
-
[Environment$1.SANDBOX]: 'arn:aws:sns:us-east-2:783421985614:'
|
|
72010
|
-
};
|
|
72011
|
-
/**
|
|
72012
|
-
* handle will validate webhook message origin and verify signature of the message and calls corresponding handlers passed in.
|
|
72013
|
-
* @param body The request body to a webhook endpoint in json string or js object form.
|
|
72014
|
-
* @param env The Immutable environment the webhook is set up for.
|
|
72015
|
-
* @param handlers The optional handlers object for different events. The `all` handler will be triggered for all event types.
|
|
72016
|
-
* @returns The event object from the webhook message after validation and verification.
|
|
72017
|
-
*/
|
|
72018
|
-
const handle = async (body, env, handlers) => {
|
|
72019
|
-
const msg = await new Promise((resolve, reject) => {
|
|
72020
|
-
validator.validate(body, (err, message) => {
|
|
72021
|
-
if (err) {
|
|
72022
|
-
return reject(err);
|
|
72023
|
-
}
|
|
72024
|
-
// check for topic arn prefix
|
|
72025
|
-
if (!message.TopicArn.startsWith(allowedTopicArnPrefix[env])) {
|
|
72026
|
-
throw new Error('Invalid topic arn');
|
|
72027
|
-
}
|
|
72028
|
-
if (message?.Type === 'SubscriptionConfirmation') {
|
|
72029
|
-
fetch(message.SubscribeURL).then(() => {
|
|
72030
|
-
resolve(message);
|
|
72031
|
-
}).catch((e) => {
|
|
72032
|
-
reject(e);
|
|
72033
|
-
});
|
|
72034
|
-
}
|
|
72035
|
-
return resolve(message);
|
|
72036
|
-
});
|
|
72037
|
-
});
|
|
72038
|
-
const event = JSON.parse(msg.Message);
|
|
72039
|
-
if (msg.Type === 'Notification') {
|
|
72040
|
-
switch (event.event_name) {
|
|
72041
|
-
case 'imtbl_zkevm_mint_request_updated':
|
|
72042
|
-
if (handlers?.zkevmMintRequestUpdated) {
|
|
72043
|
-
await handlers?.zkevmMintRequestUpdated(event);
|
|
72044
|
-
}
|
|
72045
|
-
break;
|
|
72046
|
-
case 'imtbl_zkevm_activity_mint':
|
|
72047
|
-
if (handlers?.zkEvmActivityMint) {
|
|
72048
|
-
await handlers?.zkEvmActivityMint(event);
|
|
72049
|
-
}
|
|
72050
|
-
break;
|
|
72051
|
-
case 'imtbl_zkevm_activity_burn':
|
|
72052
|
-
if (handlers?.zkEvmActivityBurn) {
|
|
72053
|
-
await handlers?.zkEvmActivityBurn(event);
|
|
72054
|
-
}
|
|
72055
|
-
break;
|
|
72056
|
-
case 'imtbl_zkevm_activity_transfer':
|
|
72057
|
-
if (handlers?.zkEvmActivityTransfer) {
|
|
72058
|
-
await handlers?.zkEvmActivityTransfer(event);
|
|
72059
|
-
}
|
|
72060
|
-
break;
|
|
72061
|
-
case 'imtbl_zkevm_activity_sale':
|
|
72062
|
-
if (handlers?.zkEvmActivitySale) {
|
|
72063
|
-
await handlers?.zkEvmActivitySale(event);
|
|
72064
|
-
}
|
|
72065
|
-
break;
|
|
72066
|
-
case 'imtbl_zkevm_activity_deposit':
|
|
72067
|
-
if (handlers?.zkEvmActivityDeposit) {
|
|
72068
|
-
await handlers?.zkEvmActivityDeposit(event);
|
|
72069
|
-
}
|
|
72070
|
-
break;
|
|
72071
|
-
case 'imtbl_zkevm_activity_withdrawal':
|
|
72072
|
-
if (handlers?.zkEvmActivityWithdrawal) {
|
|
72073
|
-
await handlers?.zkEvmActivityWithdrawal(event);
|
|
72074
|
-
}
|
|
72075
|
-
break;
|
|
72076
|
-
case 'imtbl_zkevm_collection_updated':
|
|
72077
|
-
if (handlers?.zkEvmCollectionUpdated) {
|
|
72078
|
-
await handlers?.zkEvmCollectionUpdated(event);
|
|
72079
|
-
}
|
|
72080
|
-
break;
|
|
72081
|
-
case 'imtbl_zkevm_nft_updated':
|
|
72082
|
-
if (handlers?.zkEvmNftUpdated) {
|
|
72083
|
-
await handlers?.zkEvmNftUpdated(event);
|
|
72084
|
-
}
|
|
72085
|
-
break;
|
|
72086
|
-
case 'imtbl_zkevm_metadata_updated':
|
|
72087
|
-
if (handlers?.zkEvmMetadataUpdated) {
|
|
72088
|
-
await handlers?.zkEvmMetadataUpdated(event);
|
|
72089
|
-
}
|
|
72090
|
-
break;
|
|
72091
|
-
case 'imtbl_zkevm_token_updated':
|
|
72092
|
-
if (handlers?.zkEvmTokenUpdated) {
|
|
72093
|
-
await handlers?.zkEvmTokenUpdated(event);
|
|
72094
|
-
}
|
|
72095
|
-
break;
|
|
72096
|
-
case 'imtbl_zkevm_order_updated':
|
|
72097
|
-
if (handlers?.zkEvmOrderUpdated) {
|
|
72098
|
-
await handlers?.zkEvmOrderUpdated(event);
|
|
72099
|
-
}
|
|
72100
|
-
break;
|
|
72101
|
-
case 'imtbl_zkevm_trade_created':
|
|
72102
|
-
if (handlers?.zkEvmTradeCreated) {
|
|
72103
|
-
await handlers?.zkEvmTradeCreated(event);
|
|
72104
|
-
}
|
|
72105
|
-
break;
|
|
72106
|
-
case 'imtbl_x_nft_created':
|
|
72107
|
-
if (handlers?.xNftCreated) {
|
|
72108
|
-
await handlers?.xNftCreated(event);
|
|
72109
|
-
}
|
|
72110
|
-
break;
|
|
72111
|
-
case 'imtbl_x_nft_updated':
|
|
72112
|
-
if (handlers?.xNftUpdated) {
|
|
72113
|
-
await handlers?.xNftUpdated(event);
|
|
72114
|
-
}
|
|
72115
|
-
break;
|
|
72116
|
-
case 'imtbl_x_order_accepted':
|
|
72117
|
-
if (handlers?.xOrderAccepted) {
|
|
72118
|
-
await handlers?.xOrderAccepted(event);
|
|
72119
|
-
}
|
|
72120
|
-
break;
|
|
72121
|
-
case 'imtbl_x_order_filled':
|
|
72122
|
-
if (handlers?.xOrderFilled) {
|
|
72123
|
-
await handlers?.xOrderFilled(event);
|
|
72124
|
-
}
|
|
72125
|
-
break;
|
|
72126
|
-
case 'imtbl_x_order_cancelled':
|
|
72127
|
-
if (handlers?.xOrderCancelled) {
|
|
72128
|
-
await handlers?.xOrderCancelled(event);
|
|
72129
|
-
}
|
|
72130
|
-
break;
|
|
72131
|
-
case 'imtbl_x_transfer_created':
|
|
72132
|
-
if (handlers?.xTransferCreated) {
|
|
72133
|
-
await handlers?.xTransferCreated(event);
|
|
72134
|
-
}
|
|
72135
|
-
break;
|
|
72136
|
-
}
|
|
72137
|
-
if (handlers?.all) {
|
|
72138
|
-
await handlers?.all(event);
|
|
72139
|
-
}
|
|
72140
|
-
}
|
|
72141
|
-
return event;
|
|
72142
|
-
};
|
|
72143
|
-
|
|
72144
|
-
var webhook = /*#__PURE__*/Object.freeze({
|
|
72145
|
-
__proto__: null,
|
|
72146
|
-
handle: handle
|
|
72147
|
-
});
|
|
72148
|
-
|
|
72149
|
-
const moduleName = 'minting_backend_sdk';
|
|
72150
|
-
const trackInitializePersistencePG = () => {
|
|
72151
|
-
try {
|
|
72152
|
-
track(moduleName, 'initializePersistencePG');
|
|
72153
|
-
}
|
|
72154
|
-
catch {
|
|
72155
|
-
// ignore
|
|
72156
|
-
}
|
|
72157
|
-
};
|
|
72158
|
-
const trackInitializePersistencePrismaSqlite = () => {
|
|
72159
|
-
try {
|
|
72160
|
-
track(moduleName, 'initializePersistencePrismaSqlite');
|
|
72161
|
-
}
|
|
72162
|
-
catch {
|
|
72163
|
-
// ignore
|
|
72164
|
-
}
|
|
72165
|
-
};
|
|
72166
|
-
const trackSubmitMintingRequests = () => {
|
|
72167
|
-
try {
|
|
72168
|
-
track(moduleName, 'submitMintingRequests');
|
|
72169
|
-
}
|
|
72170
|
-
catch {
|
|
72171
|
-
// ignore
|
|
72172
|
-
}
|
|
72173
|
-
};
|
|
72174
|
-
const trackProcessMint = () => {
|
|
72175
|
-
try {
|
|
72176
|
-
track(moduleName, 'processMint');
|
|
72177
|
-
}
|
|
72178
|
-
catch {
|
|
72179
|
-
// ignore
|
|
72180
|
-
}
|
|
72181
|
-
};
|
|
72182
|
-
const trackRecordMint = () => {
|
|
72183
|
-
try {
|
|
72184
|
-
track(moduleName, 'recordMint');
|
|
72185
|
-
}
|
|
72186
|
-
catch {
|
|
72187
|
-
// ignore
|
|
72188
|
-
}
|
|
72189
|
-
};
|
|
72190
|
-
const trackError = (error) => {
|
|
72191
|
-
try {
|
|
72192
|
-
track(moduleName, 'error', {
|
|
72193
|
-
name: error.name,
|
|
72194
|
-
message: error.message
|
|
72195
|
-
});
|
|
72196
|
-
}
|
|
72197
|
-
catch {
|
|
72198
|
-
// ignore
|
|
72199
|
-
}
|
|
72200
|
-
};
|
|
72201
|
-
const trackUncaughtException = (error, origin) => {
|
|
72202
|
-
try {
|
|
72203
|
-
track(moduleName, 'error', {
|
|
72204
|
-
name: error.name,
|
|
72205
|
-
message: error.message,
|
|
72206
|
-
origin,
|
|
72207
|
-
});
|
|
72208
|
-
}
|
|
72209
|
-
catch {
|
|
72210
|
-
// ignore
|
|
72211
|
-
}
|
|
72212
|
-
};
|
|
72213
|
-
|
|
72214
|
-
const mintingPersistence$1 = (client) => {
|
|
72215
|
-
trackInitializePersistencePG();
|
|
72216
|
-
return {
|
|
72217
|
-
recordMint: async (request) => {
|
|
72218
|
-
const r = await client.query(`
|
|
72219
|
-
INSERT INTO im_assets (asset_id, contract_address, owner_address, metadata, amount, token_id)
|
|
72220
|
-
VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (asset_id, contract_address) DO NOTHING;
|
|
72221
|
-
`, [
|
|
72222
|
-
request.asset_id, request.contract_address, request.owner_address,
|
|
72223
|
-
request.metadata, request.amount, request.token_id
|
|
72224
|
-
]);
|
|
72225
|
-
if (r.rowCount === 0) {
|
|
72226
|
-
throw new Error('Duplicated mint');
|
|
72227
|
-
}
|
|
72228
|
-
},
|
|
72229
|
-
getNextBatchForSubmission: async (limit) => {
|
|
72230
|
-
const res = await client.query(`
|
|
72231
|
-
UPDATE im_assets SET minting_status = 'submitting' WHERE minting_status IS NULL and id in (
|
|
72232
|
-
select id from im_assets where minting_status is null limit $1 for update skip locked
|
|
72233
|
-
) returning *;
|
|
72234
|
-
`, [limit]);
|
|
72235
|
-
return res.rows;
|
|
72236
|
-
},
|
|
72237
|
-
updateMintingStatusToSubmitted: async (ids) => {
|
|
72238
|
-
await client.query(`
|
|
72239
|
-
UPDATE im_assets SET minting_status = $2 WHERE id = ANY($1);
|
|
72240
|
-
`, [ids, 'submitted']);
|
|
72241
|
-
},
|
|
72242
|
-
syncMintingStatus: async (submittedMintRequest) => {
|
|
72243
|
-
// doing a upsert just in case the row has not been created yet
|
|
72244
|
-
await client.query(`
|
|
72245
|
-
INSERT INTO im_assets (
|
|
72246
|
-
asset_id,
|
|
72247
|
-
contract_address,
|
|
72248
|
-
owner_address,
|
|
72249
|
-
token_id,
|
|
72250
|
-
minting_status,
|
|
72251
|
-
metadata_id,
|
|
72252
|
-
last_imtbl_zkevm_mint_request_updated_id,
|
|
72253
|
-
error,
|
|
72254
|
-
amount
|
|
72255
|
-
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) ON CONFLICT (asset_id, contract_address)
|
|
72256
|
-
DO UPDATE SET
|
|
72257
|
-
owner_address = $3,
|
|
72258
|
-
token_id = $4,
|
|
72259
|
-
minting_status = $5,
|
|
72260
|
-
metadata_id = $6,
|
|
72261
|
-
last_imtbl_zkevm_mint_request_updated_id = $7,
|
|
72262
|
-
error = $8
|
|
72263
|
-
where (
|
|
72264
|
-
im_assets.last_imtbl_zkevm_mint_request_updated_id < $7 OR
|
|
72265
|
-
im_assets.last_imtbl_zkevm_mint_request_updated_id is null
|
|
72266
|
-
);
|
|
72267
|
-
`, [
|
|
72268
|
-
submittedMintRequest.assetId,
|
|
72269
|
-
submittedMintRequest.contractAddress,
|
|
72270
|
-
submittedMintRequest.ownerAddress,
|
|
72271
|
-
submittedMintRequest.tokenId,
|
|
72272
|
-
submittedMintRequest.status,
|
|
72273
|
-
submittedMintRequest.metadataId,
|
|
72274
|
-
submittedMintRequest.imtblZkevmMintRequestUpdatedId,
|
|
72275
|
-
submittedMintRequest.error,
|
|
72276
|
-
submittedMintRequest.amount
|
|
72277
|
-
]);
|
|
72278
|
-
},
|
|
72279
|
-
markAsConflict: async (assetIds, contractAddress) => {
|
|
72280
|
-
await client.query(`
|
|
72281
|
-
UPDATE im_assets
|
|
72282
|
-
SET minting_status = 'conflicting'
|
|
72283
|
-
WHERE asset_id = ANY($1)
|
|
72284
|
-
AND contract_address = $2;
|
|
72285
|
-
`, [assetIds, contractAddress]);
|
|
72286
|
-
},
|
|
72287
|
-
resetMintingStatus: async (ids) => {
|
|
72288
|
-
await client.query(`
|
|
72289
|
-
UPDATE im_assets SET minting_status = null WHERE id = ANY($1);
|
|
72290
|
-
`, [ids]);
|
|
72291
|
-
},
|
|
72292
|
-
markForRetry: async (ids) => {
|
|
72293
|
-
await client.query(`
|
|
72294
|
-
UPDATE im_assets
|
|
72295
|
-
SET minting_status = null, tried_count = tried_count + 1 WHERE id = ANY($1);
|
|
72296
|
-
`, [ids]);
|
|
72297
|
-
},
|
|
72298
|
-
updateMintingStatusToSubmissionFailed: async (ids) => {
|
|
72299
|
-
await client.query(`
|
|
72300
|
-
UPDATE im_assets SET minting_status = 'submission_failed' WHERE id = ANY($1);
|
|
72301
|
-
`, [ids]);
|
|
72302
|
-
},
|
|
72303
|
-
getMintingRequest: async (contractAddress, referenceId) => {
|
|
72304
|
-
const res = await client.query(`
|
|
72305
|
-
SELECT * FROM im_assets WHERE contract_address = $1 and asset_id = $2;
|
|
72306
|
-
`, [contractAddress, referenceId]);
|
|
72307
|
-
return res.rows[0] || null;
|
|
72308
|
-
}
|
|
72309
|
-
};
|
|
72310
|
-
};
|
|
72311
|
-
|
|
72312
|
-
/* eslint-disable no-await-in-loop */
|
|
72313
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
72314
|
-
// client is a PrismaClient instance. it needs to be generated with
|
|
72315
|
-
// additional schema defined inside (TODO: point to repo) file.
|
|
72316
|
-
const mintingPersistence = (client) => {
|
|
72317
|
-
trackInitializePersistencePrismaSqlite();
|
|
72318
|
-
return {
|
|
72319
|
-
recordMint: async (request) => {
|
|
72320
|
-
const result = await client.imAssets.upsert({
|
|
72321
|
-
where: {
|
|
72322
|
-
im_assets_uindex: {
|
|
72323
|
-
assetId: request.asset_id, contractAddress: request.contract_address
|
|
72324
|
-
}
|
|
72325
|
-
},
|
|
72326
|
-
update: {},
|
|
72327
|
-
create: {
|
|
72328
|
-
assetId: request.asset_id,
|
|
72329
|
-
contractAddress: request.contract_address,
|
|
72330
|
-
ownerAddress: request.owner_address,
|
|
72331
|
-
metadata: JSON.stringify(request.metadata),
|
|
72332
|
-
amount: request.amount || null,
|
|
72333
|
-
tokenId: request.token_id || null,
|
|
72334
|
-
},
|
|
72335
|
-
});
|
|
72336
|
-
// Since upsert does not throw on update and does not tell directly if it updated or inserted,
|
|
72337
|
-
// we need to add additional logic to handle this if "result" does not provide enough info.
|
|
72338
|
-
if (!result) {
|
|
72339
|
-
throw new Error('Duplicated mint');
|
|
72340
|
-
}
|
|
72341
|
-
},
|
|
72342
|
-
// WARNING: this is NOT concurrency safe. Please only call this method one at a time.
|
|
72343
|
-
getNextBatchForSubmission: async (limit) => {
|
|
72344
|
-
const assets = await client.imAssets.findMany({
|
|
72345
|
-
where: {
|
|
72346
|
-
mintingStatus: null
|
|
72347
|
-
},
|
|
72348
|
-
take: limit
|
|
72349
|
-
});
|
|
72350
|
-
const assetIds = assets.map((asset) => asset.id);
|
|
72351
|
-
await client.imAssets.updateMany({
|
|
72352
|
-
where: {
|
|
72353
|
-
id: {
|
|
72354
|
-
in: assetIds
|
|
72355
|
-
}
|
|
72356
|
-
},
|
|
72357
|
-
data: {
|
|
72358
|
-
mintingStatus: 'submitting'
|
|
72359
|
-
}
|
|
72360
|
-
});
|
|
72361
|
-
const updatedAssets = await client.imAssets.findMany({
|
|
72362
|
-
where: {
|
|
72363
|
-
id: {
|
|
72364
|
-
in: assetIds
|
|
72365
|
-
}
|
|
72366
|
-
}
|
|
72367
|
-
});
|
|
72368
|
-
return updatedAssets.map((asset) => ({
|
|
72369
|
-
id: asset.id,
|
|
72370
|
-
contract_address: asset.contractAddress,
|
|
72371
|
-
wallet_address: asset.ownerAddress,
|
|
72372
|
-
asset_id: asset.assetId,
|
|
72373
|
-
metadata: asset.metadata ? JSON.parse(asset.metadata) : null,
|
|
72374
|
-
owner_address: asset.ownerAddress,
|
|
72375
|
-
tried_count: asset.triedCount,
|
|
72376
|
-
amount: asset.amount || null,
|
|
72377
|
-
token_id: asset.tokenId || null,
|
|
72378
|
-
}));
|
|
72379
|
-
},
|
|
72380
|
-
updateMintingStatusToSubmitted: async (ids) => {
|
|
72381
|
-
await client.imAssets.updateMany({
|
|
72382
|
-
where: {
|
|
72383
|
-
id: {
|
|
72384
|
-
in: ids
|
|
72385
|
-
}
|
|
72386
|
-
},
|
|
72387
|
-
data: {
|
|
72388
|
-
mintingStatus: 'submitted'
|
|
72389
|
-
}
|
|
72390
|
-
});
|
|
72391
|
-
},
|
|
72392
|
-
syncMintingStatus: async (submittedMintRequest) => {
|
|
72393
|
-
// First, attempt to retrieve the existing asset
|
|
72394
|
-
const existingAsset = await client.imAssets.findUnique({
|
|
72395
|
-
where: {
|
|
72396
|
-
im_assets_uindex: {
|
|
72397
|
-
assetId: submittedMintRequest.assetId,
|
|
72398
|
-
contractAddress: submittedMintRequest.contractAddress,
|
|
72399
|
-
},
|
|
72400
|
-
}
|
|
72401
|
-
});
|
|
72402
|
-
// Check if the asset exists and the condition for updating is met
|
|
72403
|
-
if (existingAsset && (existingAsset.lastImtblZkevmMintRequestUpdatedId === null
|
|
72404
|
-
|| existingAsset.lastImtblZkevmMintRequestUpdatedId < submittedMintRequest.imtblZkevmMintRequestUpdatedId)) {
|
|
72405
|
-
// Perform update if the existing record's lastImtblZkevmMintRequestUpdatedId is less than the new one or is null
|
|
72406
|
-
await client.imAssets.update({
|
|
72407
|
-
where: {
|
|
72408
|
-
im_assets_uindex: {
|
|
72409
|
-
assetId: submittedMintRequest.assetId,
|
|
72410
|
-
contractAddress: submittedMintRequest.contractAddress,
|
|
72411
|
-
},
|
|
72412
|
-
},
|
|
72413
|
-
data: {
|
|
72414
|
-
ownerAddress: submittedMintRequest.ownerAddress,
|
|
72415
|
-
tokenId: submittedMintRequest.tokenId,
|
|
72416
|
-
mintingStatus: submittedMintRequest.status,
|
|
72417
|
-
metadataId: submittedMintRequest.metadataId,
|
|
72418
|
-
lastImtblZkevmMintRequestUpdatedId: submittedMintRequest.imtblZkevmMintRequestUpdatedId,
|
|
72419
|
-
error: submittedMintRequest.error,
|
|
72420
|
-
amount: submittedMintRequest.amount || null
|
|
72421
|
-
}
|
|
72422
|
-
});
|
|
72423
|
-
}
|
|
72424
|
-
else if (!existingAsset) {
|
|
72425
|
-
// Perform insert if no existing record is found
|
|
72426
|
-
await client.imAssets.create({
|
|
72427
|
-
data: {
|
|
72428
|
-
assetId: submittedMintRequest.assetId,
|
|
72429
|
-
contractAddress: submittedMintRequest.contractAddress,
|
|
72430
|
-
ownerAddress: submittedMintRequest.ownerAddress,
|
|
72431
|
-
tokenId: submittedMintRequest.tokenId,
|
|
72432
|
-
mintingStatus: submittedMintRequest.status,
|
|
72433
|
-
metadataId: submittedMintRequest.metadataId,
|
|
72434
|
-
lastImtblZkevmMintRequestUpdatedId: submittedMintRequest.imtblZkevmMintRequestUpdatedId,
|
|
72435
|
-
error: submittedMintRequest.error,
|
|
72436
|
-
amount: submittedMintRequest.amount || null
|
|
72437
|
-
}
|
|
72438
|
-
});
|
|
72439
|
-
}
|
|
72440
|
-
// If existing asset does not meet the update condition, do nothing
|
|
72441
|
-
},
|
|
72442
|
-
updateMintingStatusToSubmissionFailed: async (ids) => {
|
|
72443
|
-
await client.imAssets.updateMany({
|
|
72444
|
-
where: {
|
|
72445
|
-
id: {
|
|
72446
|
-
in: ids
|
|
72447
|
-
}
|
|
72448
|
-
},
|
|
72449
|
-
data: {
|
|
72450
|
-
mintingStatus: 'submission_failed'
|
|
72451
|
-
}
|
|
72452
|
-
});
|
|
72453
|
-
},
|
|
72454
|
-
markAsConflict: async (assetIds, contractAddress) => {
|
|
72455
|
-
await client.imAssets.updateMany({
|
|
72456
|
-
where: {
|
|
72457
|
-
assetId: {
|
|
72458
|
-
in: assetIds // Targets assets where assetId is in the provided list
|
|
72459
|
-
},
|
|
72460
|
-
contractAddress // Additional condition for contract address
|
|
72461
|
-
},
|
|
72462
|
-
data: {
|
|
72463
|
-
mintingStatus: 'conflicting' // Set the new status
|
|
72464
|
-
}
|
|
72465
|
-
});
|
|
72466
|
-
},
|
|
72467
|
-
resetMintingStatus: async (ids) => {
|
|
72468
|
-
await client.imAssets.updateMany({
|
|
72469
|
-
where: {
|
|
72470
|
-
id: {
|
|
72471
|
-
in: ids // Condition to match ids
|
|
72472
|
-
}
|
|
72473
|
-
},
|
|
72474
|
-
data: {
|
|
72475
|
-
mintingStatus: null // Setting minting_status to null
|
|
72476
|
-
}
|
|
72477
|
-
});
|
|
72478
|
-
},
|
|
72479
|
-
// this method is not concurrency safe
|
|
72480
|
-
markForRetry: async (ids) => {
|
|
72481
|
-
// Retrieve the current values of tried_count for the specified ids
|
|
72482
|
-
const assets = await client.imAssets.findMany({
|
|
72483
|
-
where: {
|
|
72484
|
-
id: {
|
|
72485
|
-
in: ids
|
|
72486
|
-
}
|
|
72487
|
-
},
|
|
72488
|
-
select: {
|
|
72489
|
-
id: true,
|
|
72490
|
-
triedCount: true // Assuming the field is named triedCount
|
|
72491
|
-
}
|
|
72492
|
-
});
|
|
72493
|
-
// Update each asset with the new tried_count and nullify minting_status
|
|
72494
|
-
for (const asset of assets) {
|
|
72495
|
-
await client.imAssets.update({
|
|
72496
|
-
where: {
|
|
72497
|
-
id: asset.id
|
|
72498
|
-
},
|
|
72499
|
-
data: {
|
|
72500
|
-
mintingStatus: null,
|
|
72501
|
-
triedCount: asset.triedCount + 1
|
|
72502
|
-
}
|
|
72503
|
-
});
|
|
72504
|
-
}
|
|
72505
|
-
},
|
|
72506
|
-
getMintingRequest: async (contractAddress, referenceId) => {
|
|
72507
|
-
// Retrieve the asset from the database based on contract_address and asset_id
|
|
72508
|
-
const asset = await client.imAssets.findFirst({
|
|
72509
|
-
where: {
|
|
72510
|
-
contractAddress,
|
|
72511
|
-
assetId: referenceId
|
|
72512
|
-
}
|
|
72513
|
-
});
|
|
72514
|
-
if (!asset) {
|
|
72515
|
-
return null;
|
|
72516
|
-
}
|
|
72517
|
-
return {
|
|
72518
|
-
asset_id: asset.assetId,
|
|
72519
|
-
contract_address: asset.contractAddress,
|
|
72520
|
-
id: asset.id,
|
|
72521
|
-
metadata: asset.metadata ? JSON.parse(asset.metadata) : null,
|
|
72522
|
-
owner_address: asset.ownerAddress,
|
|
72523
|
-
tried_count: asset.triedCount,
|
|
72524
|
-
wallet_address: asset.ownerAddress,
|
|
72525
|
-
amount: asset.amount || null
|
|
72526
|
-
};
|
|
72527
|
-
}
|
|
72528
|
-
};
|
|
72529
|
-
};
|
|
72530
|
-
|
|
72531
|
-
// TODO: expose metrics
|
|
72532
|
-
// - submitting status count, conflicting status count
|
|
72533
|
-
// - failed events count
|
|
72534
|
-
const recordMint = async (mintingPersistence, mintRequest) => {
|
|
72535
|
-
trackRecordMint();
|
|
72536
|
-
mintingPersistence.recordMint(mintRequest);
|
|
72537
|
-
};
|
|
72538
|
-
const defaultMintingDelay = 1000;
|
|
72539
|
-
// This function can be called in different node process and will run in parallel to mint assets.
|
|
72540
|
-
// Each process will NOT mint the same asset.
|
|
72541
|
-
// Monitor your database to see if parallel processes are saturating the database CPU and triggering excessive vacuuming.
|
|
72542
|
-
// default batch size will be treated as 100 when it exceeds 100 because minting API has a limit of 100 assets per request.
|
|
72543
|
-
const submitMintingRequests = async (mintingPersistence, blockchainDataSDKClient, { defaultBatchSize = 1000, chainName = 'imtbl-zkevm-testnet', maxNumberOfTries = 3, }, logger = console) => {
|
|
72544
|
-
trackSubmitMintingRequests();
|
|
72545
|
-
let mintingResponse;
|
|
72546
|
-
// eslint-disable-next-line no-constant-condition
|
|
72547
|
-
while (true) {
|
|
72548
|
-
await new Promise((resolve) => {
|
|
72549
|
-
setTimeout(resolve, defaultMintingDelay);
|
|
72550
|
-
});
|
|
72551
|
-
let batchSize = Math.min(mintingResponse?.imx_remaining_mint_requests
|
|
72552
|
-
? parseInt(mintingResponse.imx_remaining_mint_requests, 10)
|
|
72553
|
-
: defaultBatchSize, defaultBatchSize);
|
|
72554
|
-
if (batchSize === 0
|
|
72555
|
-
&& mintingResponse
|
|
72556
|
-
&& new Date(mintingResponse.imx_mint_requests_limit_reset) > new Date()) {
|
|
72557
|
-
logger.info(`minting limit reached, waiting for reset at ${mintingResponse?.imx_mint_requests_limit_reset}`);
|
|
72558
|
-
continue;
|
|
72559
|
-
}
|
|
72560
|
-
if (batchSize === 0) {
|
|
72561
|
-
logger.info(`minting limit has been reset, use default batch size: ${defaultBatchSize}`);
|
|
72562
|
-
mintingResponse = undefined;
|
|
72563
|
-
batchSize = defaultBatchSize;
|
|
72564
|
-
}
|
|
72565
|
-
// get mints to be submitted
|
|
72566
|
-
const pendingMints = await mintingPersistence.getNextBatchForSubmission(batchSize);
|
|
72567
|
-
if (pendingMints.length === 0) {
|
|
72568
|
-
logger.info('no assets to mint');
|
|
72569
|
-
continue;
|
|
72570
|
-
}
|
|
72571
|
-
// chunk assets by every 100 assets. every chunk should all be for the same contract address.
|
|
72572
|
-
const chunkedAssets = pendingMints.sort((a, b) => (a.contract_address > b.contract_address ? 1 : -1)).reduce((acc, row) => {
|
|
72573
|
-
if (acc.length === 0) {
|
|
72574
|
-
return [{ contractAddress: row.contract_address, assets: [row] }];
|
|
72575
|
-
}
|
|
72576
|
-
const lastBatch = acc[acc.length - 1];
|
|
72577
|
-
if (lastBatch.contractAddress === row.contract_address && lastBatch.assets.length < 100) {
|
|
72578
|
-
return [...acc.slice(0, -1), { ...lastBatch, assets: [...lastBatch.assets, row] }];
|
|
72579
|
-
}
|
|
72580
|
-
return [...acc, { contractAddress: row.contract_address, assets: [row] }];
|
|
72581
|
-
}, []);
|
|
72582
|
-
// submit minting request for each contract address in parallel
|
|
72583
|
-
const mintingResults = await Promise.allSettled(chunkedAssets.map(async ({ contractAddress, assets }) => {
|
|
72584
|
-
const mintingRequest = {
|
|
72585
|
-
chainName,
|
|
72586
|
-
contractAddress,
|
|
72587
|
-
createMintRequestRequest: {
|
|
72588
|
-
assets: assets.map((row) => ({
|
|
72589
|
-
reference_id: row.asset_id,
|
|
72590
|
-
owner_address: row.owner_address,
|
|
72591
|
-
metadata: row.metadata,
|
|
72592
|
-
token_id: row.token_id,
|
|
72593
|
-
amount: row.amount ? `${row.amount}` : null,
|
|
72594
|
-
})),
|
|
72595
|
-
},
|
|
72596
|
-
};
|
|
72597
|
-
try {
|
|
72598
|
-
const response = await blockchainDataSDKClient.createMintRequest(mintingRequest);
|
|
72599
|
-
logger.info(`mintingResponse: ${JSON.stringify(response, null, 2)}`);
|
|
72600
|
-
// update minting status to submitted
|
|
72601
|
-
await mintingPersistence.updateMintingStatusToSubmitted(assets.map(({ id }) => id));
|
|
72602
|
-
return response;
|
|
72603
|
-
}
|
|
72604
|
-
catch (e) {
|
|
72605
|
-
logger.error(e);
|
|
72606
|
-
trackError(e);
|
|
72607
|
-
if (e.code === 'CONFLICT_ERROR'
|
|
72608
|
-
&& e.details?.id === 'reference_id') {
|
|
72609
|
-
try {
|
|
72610
|
-
// mark the assets as conflicting, so that we don't send them again.
|
|
72611
|
-
await mintingPersistence.markAsConflict(e.details.values, contractAddress);
|
|
72612
|
-
// remove non conflicting assets status so that they can be retried.
|
|
72613
|
-
await mintingPersistence.resetMintingStatus(assets
|
|
72614
|
-
.map(({ id }) => id)
|
|
72615
|
-
.filter((id) => !e.details.values.includes(id)));
|
|
72616
|
-
}
|
|
72617
|
-
catch (e2) {
|
|
72618
|
-
logger.error(e2);
|
|
72619
|
-
trackError(e);
|
|
72620
|
-
}
|
|
72621
|
-
}
|
|
72622
|
-
else {
|
|
72623
|
-
// separate assets into "need to be retied" and "exceeded max number of tries."
|
|
72624
|
-
const { assetsToRetry, assetsExceededMaxNumberOfTries } = assets.reduce((acc, { tried_count = 0, id }) => {
|
|
72625
|
-
if (tried_count < maxNumberOfTries) {
|
|
72626
|
-
acc.assetsToRetry.push(id);
|
|
72627
|
-
}
|
|
72628
|
-
else {
|
|
72629
|
-
acc.assetsExceededMaxNumberOfTries.push(id);
|
|
72630
|
-
}
|
|
72631
|
-
return acc;
|
|
72632
|
-
}, {
|
|
72633
|
-
assetsToRetry: [],
|
|
72634
|
-
assetsExceededMaxNumberOfTries: [],
|
|
72635
|
-
});
|
|
72636
|
-
// remove all assets status so that they can be retried.
|
|
72637
|
-
await mintingPersistence.markForRetry(assetsToRetry);
|
|
72638
|
-
// mark assets that have exceeded the max number of tries as submission_failed
|
|
72639
|
-
await mintingPersistence.updateMintingStatusToSubmissionFailed(assetsExceededMaxNumberOfTries);
|
|
72640
|
-
}
|
|
72641
|
-
return e;
|
|
72642
|
-
}
|
|
72643
|
-
}));
|
|
72644
|
-
mintingResponse = mintingResults
|
|
72645
|
-
.reverse()
|
|
72646
|
-
.find((r) => r.status === 'fulfilled')?.value;
|
|
72647
|
-
}
|
|
72648
|
-
};
|
|
72649
|
-
const processMint = async (mintingPersistence, event, logger = console) => {
|
|
72650
|
-
trackProcessMint();
|
|
72651
|
-
if (event.event_name !== 'imtbl_zkevm_mint_request_updated') {
|
|
72652
|
-
logger.info(`${event.event_name} is not imtbl_zkevm_mint_request_updated, skip.`);
|
|
72653
|
-
return;
|
|
72654
|
-
}
|
|
72655
|
-
const referenceId = event.data.reference_id;
|
|
72656
|
-
if (!referenceId) {
|
|
72657
|
-
throw new Error('reference_id not found in webhook event');
|
|
72658
|
-
}
|
|
72659
|
-
const contractAddress = event.data.contract_address;
|
|
72660
|
-
if (!contractAddress) {
|
|
72661
|
-
throw new Error('contract_address not found in webhook event');
|
|
72662
|
-
}
|
|
72663
|
-
if (event.data.status === 'failed') {
|
|
72664
|
-
logger.error(`mint failed: ${JSON.stringify(event.data, null, 2)}`);
|
|
72665
|
-
}
|
|
72666
|
-
const mintReq = await mintingPersistence.getMintingRequest(contractAddress, referenceId);
|
|
72667
|
-
if (!mintReq) {
|
|
72668
|
-
logger.info(`minting request not found in the database, ${JSON.stringify(event.data)}`);
|
|
72669
|
-
}
|
|
72670
|
-
const ownerAddress = mintReq?.wallet_address || event.data.owner_address;
|
|
72671
|
-
if (!ownerAddress) {
|
|
72672
|
-
logger.error('owner_address missing');
|
|
72673
|
-
throw new Error('owner_address missing');
|
|
72674
|
-
}
|
|
72675
|
-
await mintingPersistence.syncMintingStatus({
|
|
72676
|
-
tokenId: event.data.token_id,
|
|
72677
|
-
status: event.data.status,
|
|
72678
|
-
assetId: referenceId,
|
|
72679
|
-
contractAddress,
|
|
72680
|
-
ownerAddress,
|
|
72681
|
-
metadataId: event.data.metadata_id,
|
|
72682
|
-
imtblZkevmMintRequestUpdatedId: event.event_id,
|
|
72683
|
-
error: event.data.error ? JSON.stringify(event.data.error) : null,
|
|
72684
|
-
amount: event.data.amount || null,
|
|
72685
|
-
});
|
|
72686
|
-
};
|
|
72687
|
-
|
|
72688
|
-
const noopHandlers = {
|
|
72689
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72690
|
-
zkevmMintRequestUpdated: async (event) => { }
|
|
72691
|
-
};
|
|
72692
|
-
class MintingBackendModule {
|
|
72693
|
-
baseConfig;
|
|
72694
|
-
persistence;
|
|
72695
|
-
blockchainDataClient;
|
|
72696
|
-
logger;
|
|
72697
|
-
constructor(config) {
|
|
72698
|
-
this.baseConfig = config.baseConfig;
|
|
72699
|
-
this.persistence = config.persistence;
|
|
72700
|
-
this.logger = config.logger || console;
|
|
72701
|
-
this.blockchainDataClient = new BlockchainData({
|
|
72702
|
-
baseConfig: config.baseConfig
|
|
72703
|
-
});
|
|
72704
|
-
setEnvironment(this.baseConfig.environment);
|
|
72705
|
-
if (this.baseConfig.publishableKey) {
|
|
72706
|
-
setPublishableApiKey(this.baseConfig.publishableKey);
|
|
72707
|
-
}
|
|
72708
|
-
}
|
|
72709
|
-
async recordMint(mintRequest) {
|
|
72710
|
-
await recordMint(this.persistence, mintRequest);
|
|
72711
|
-
}
|
|
72712
|
-
async submitMintingRequests(config) {
|
|
72713
|
-
await submitMintingRequests(this.persistence, this.blockchainDataClient, config);
|
|
72714
|
-
}
|
|
72715
|
-
async processMint(body, otherHandlers = noopHandlers) {
|
|
72716
|
-
await handle(body, this.baseConfig.environment, {
|
|
72717
|
-
zkevmMintRequestUpdated: async (event) => {
|
|
72718
|
-
await processMint(this.persistence, event, this.logger);
|
|
72719
|
-
if (otherHandlers.zkevmMintRequestUpdated) {
|
|
72720
|
-
otherHandlers.zkevmMintRequestUpdated(event);
|
|
72721
|
-
}
|
|
72722
|
-
}
|
|
72723
|
-
});
|
|
72724
|
-
}
|
|
72725
|
-
}
|
|
72726
|
-
if (typeof process !== 'undefined' && process.on) {
|
|
72727
|
-
try {
|
|
72728
|
-
process.on('uncaughtExceptionMonitor', trackUncaughtException);
|
|
72729
|
-
}
|
|
72730
|
-
catch {
|
|
72731
|
-
// ignore
|
|
72732
|
-
}
|
|
72733
|
-
}
|
|
72734
|
-
|
|
72735
|
-
var minting_backend = /*#__PURE__*/Object.freeze({
|
|
72736
|
-
__proto__: null,
|
|
72737
|
-
MintingBackendModule: MintingBackendModule,
|
|
72738
|
-
mintingPersistencePg: mintingPersistence$1,
|
|
72739
|
-
mintingPersistencePrismaSqlite: mintingPersistence,
|
|
72740
|
-
processMint: processMint,
|
|
72741
|
-
recordMint: recordMint,
|
|
72742
|
-
submitMintingRequests: submitMintingRequests
|
|
72743
|
-
});
|
|
72744
|
-
|
|
72745
|
-
export { blockchain_data as blockchainData, checkout, config, minting_backend as mintingBackend, orderbook, passport, webhook, x };
|
|
72005
|
+
export { blockchain_data as blockchainData, checkout, config, orderbook, passport, x };
|