@solana-mobile/dapp-store-cli 0.9.1 → 0.9.3
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/bin/dapp-store.js +1 -1
- package/lib/CliUtils.js +19 -10
- package/lib/commands/create/CreateCliApp.js +9 -61
- package/lib/commands/create/CreateCliPublisher.js +9 -61
- package/lib/commands/create/CreateCliRelease.js +9 -61
- package/lib/commands/scaffolding/ScaffoldInit.js +2 -4
- package/lib/commands/utils.js +193 -0
- package/lib/config/PublishDetails.js +2 -3
- package/lib/package.json +3 -3
- package/package.json +3 -3
- package/src/CliUtils.ts +24 -8
- package/src/commands/create/CreateCliApp.ts +7 -29
- package/src/commands/create/CreateCliPublisher.ts +7 -29
- package/src/commands/create/CreateCliRelease.ts +8 -29
- package/src/commands/scaffolding/ScaffoldInit.ts +2 -2
- package/src/commands/utils.ts +33 -0
- package/src/config/PublishDetails.ts +2 -1
package/bin/dapp-store.js
CHANGED
package/lib/CliUtils.js
CHANGED
|
@@ -145,9 +145,8 @@ import { Keypair, PublicKey } from "@solana/web3.js";
|
|
|
145
145
|
import debugModule from "debug";
|
|
146
146
|
import { IrysStorageDriver, keypairIdentity, Metaplex } from "@metaplex-foundation/js";
|
|
147
147
|
import updateNotifier from "update-notifier";
|
|
148
|
-
import
|
|
149
|
-
|
|
150
|
-
};
|
|
148
|
+
import { readFile } from "fs/promises";
|
|
149
|
+
var cliPackage = JSON.parse((await readFile(new URL("./package.json", import.meta.url))).toString());
|
|
151
150
|
import boxen from "boxen";
|
|
152
151
|
import ver from "semver";
|
|
153
152
|
import { CachedStorageDriver } from "./upload/CachedStorageDriver.js";
|
|
@@ -159,7 +158,7 @@ export var Constants = function Constants() {
|
|
|
159
158
|
"use strict";
|
|
160
159
|
_class_call_check(this, Constants);
|
|
161
160
|
};
|
|
162
|
-
_define_property(Constants, "CLI_VERSION", "0.9.
|
|
161
|
+
_define_property(Constants, "CLI_VERSION", "0.9.3");
|
|
163
162
|
_define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
|
|
164
163
|
_define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
|
|
165
164
|
_define_property(Constants, "DEFAULT_PRIORITY_FEE", 500000);
|
|
@@ -199,7 +198,7 @@ export var checkForSelfUpdate = function() {
|
|
|
199
198
|
}();
|
|
200
199
|
export var checkMintedStatus = function() {
|
|
201
200
|
var _ref = _async_to_generator(function(conn, pubAddr, appAddr, releaseAddr) {
|
|
202
|
-
var results,
|
|
201
|
+
var _results_, _results_1, _results_2, results, isPublisherMinted, isAppMinted, isReleaseMinted, errorMessage;
|
|
203
202
|
return _ts_generator(this, function(_state) {
|
|
204
203
|
switch(_state.label){
|
|
205
204
|
case 0:
|
|
@@ -213,11 +212,21 @@ export var checkMintedStatus = function() {
|
|
|
213
212
|
];
|
|
214
213
|
case 1:
|
|
215
214
|
results = _state.sent();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
|
|
215
|
+
isPublisherMinted = results[0] != undefined && ((_results_ = results[0]) === null || _results_ === void 0 ? void 0 : _results_.lamports) > 0;
|
|
216
|
+
isAppMinted = results[1] != undefined && ((_results_1 = results[1]) === null || _results_1 === void 0 ? void 0 : _results_1.lamports) > 0;
|
|
217
|
+
isReleaseMinted = results[2] != undefined && ((_results_2 = results[2]) === null || _results_2 === void 0 ? void 0 : _results_2.lamports) > 0;
|
|
218
|
+
if (!isPublisherMinted || !isAppMinted || !isReleaseMinted) {
|
|
219
|
+
errorMessage = "";
|
|
220
|
+
if (!isPublisherMinted) {
|
|
221
|
+
errorMessage = errorMessage + "Publisher NFT fetch at address ".concat(pubAddr, " failed.\n");
|
|
222
|
+
}
|
|
223
|
+
if (!isAppMinted) {
|
|
224
|
+
errorMessage = errorMessage + "App NFT fetch at address ".concat(appAddr, " failed.\n");
|
|
225
|
+
}
|
|
226
|
+
if (!isReleaseMinted) {
|
|
227
|
+
errorMessage = errorMessage + "Release NFT fetch at address ".concat(releaseAddr, " failed.\n");
|
|
228
|
+
}
|
|
229
|
+
throw new Error("Expected Publisher :: ".concat(pubAddr, ", App :: ").concat(appAddr, " and Release :: ").concat(releaseAddr, " to be minted before submission.\n\n but ").concat(errorMessage, "\n\n Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal."));
|
|
221
230
|
}
|
|
222
231
|
return [
|
|
223
232
|
2
|
|
@@ -123,12 +123,13 @@ function _ts_generator(thisArg, body) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
import { createApp } from "@solana-mobile/dapp-store-publishing-tools";
|
|
126
|
-
import { Connection, Keypair, PublicKey
|
|
127
|
-
import { Constants, getMetaplexInstance
|
|
126
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
127
|
+
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
128
128
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
129
|
+
import { sendAndConfirmTransaction } from "../utils.js";
|
|
129
130
|
var createAppNft = function() {
|
|
130
131
|
var _ref = _async_to_generator(function(param) {
|
|
131
|
-
var appDetails, connection, publisherMintAddress, publisher, storageParams, priorityFeeLamports, mintAddress, metaplex, txBuilder,
|
|
132
|
+
var appDetails, connection, publisherMintAddress, publisher, storageParams, priorityFeeLamports, mintAddress, metaplex, txBuilder, response;
|
|
132
133
|
return _ts_generator(this, function(_state) {
|
|
133
134
|
switch(_state.label){
|
|
134
135
|
case 0:
|
|
@@ -151,71 +152,19 @@ var createAppNft = function() {
|
|
|
151
152
|
case 1:
|
|
152
153
|
txBuilder = _state.sent();
|
|
153
154
|
console.info("App NFT data upload complete\nSigning transaction now");
|
|
154
|
-
maxTries = 8;
|
|
155
|
-
i = 1;
|
|
156
|
-
_state.label = 2;
|
|
157
|
-
case 2:
|
|
158
|
-
if (!(i <= maxTries)) return [
|
|
159
|
-
3,
|
|
160
|
-
8
|
|
161
|
-
];
|
|
162
|
-
_state.label = 3;
|
|
163
|
-
case 3:
|
|
164
|
-
_state.trys.push([
|
|
165
|
-
3,
|
|
166
|
-
6,
|
|
167
|
-
,
|
|
168
|
-
7
|
|
169
|
-
]);
|
|
170
155
|
return [
|
|
171
156
|
4,
|
|
172
|
-
|
|
157
|
+
sendAndConfirmTransaction(metaplex, txBuilder)
|
|
173
158
|
];
|
|
174
|
-
case
|
|
175
|
-
|
|
176
|
-
tx = txBuilder.toTransaction(blockhash.value);
|
|
177
|
-
tx.sign(mintAddress, publisher);
|
|
178
|
-
return [
|
|
179
|
-
4,
|
|
180
|
-
sendAndConfirmTransaction(connection, tx, [
|
|
181
|
-
publisher,
|
|
182
|
-
mintAddress
|
|
183
|
-
], {
|
|
184
|
-
commitment: "confirmed",
|
|
185
|
-
minContextSlot: blockhash.context.slot
|
|
186
|
-
})
|
|
187
|
-
];
|
|
188
|
-
case 5:
|
|
189
|
-
txSig = _state.sent();
|
|
159
|
+
case 2:
|
|
160
|
+
response = _state.sent().response;
|
|
190
161
|
return [
|
|
191
162
|
2,
|
|
192
163
|
{
|
|
193
164
|
appAddress: mintAddress.publicKey.toBase58(),
|
|
194
|
-
transactionSignature:
|
|
165
|
+
transactionSignature: response.signature
|
|
195
166
|
}
|
|
196
167
|
];
|
|
197
|
-
case 6:
|
|
198
|
-
e = _state.sent();
|
|
199
|
-
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
200
|
-
if (i == maxTries) {
|
|
201
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
202
|
-
process.exit(-1);
|
|
203
|
-
} else {
|
|
204
|
-
retryMsg = errorMsg + "\nWill Retry minting app NFT.";
|
|
205
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
206
|
-
}
|
|
207
|
-
return [
|
|
208
|
-
3,
|
|
209
|
-
7
|
|
210
|
-
];
|
|
211
|
-
case 7:
|
|
212
|
-
i++;
|
|
213
|
-
return [
|
|
214
|
-
3,
|
|
215
|
-
2
|
|
216
|
-
];
|
|
217
|
-
case 8:
|
|
218
|
-
throw new Error("Unable to mint app NFT");
|
|
219
168
|
}
|
|
220
169
|
});
|
|
221
170
|
});
|
|
@@ -231,8 +180,7 @@ export var createAppCommand = function() {
|
|
|
231
180
|
case 0:
|
|
232
181
|
signer = param.signer, url = param.url, dryRun = param.dryRun, publisherMintAddress = param.publisherMintAddress, storageParams = param.storageParams, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
|
|
233
182
|
connection = new Connection(url, {
|
|
234
|
-
commitment: "confirmed"
|
|
235
|
-
disableRetryOnRateLimit: true
|
|
183
|
+
commitment: "confirmed"
|
|
236
184
|
});
|
|
237
185
|
return [
|
|
238
186
|
4,
|
|
@@ -123,12 +123,13 @@ function _ts_generator(thisArg, body) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
import { createPublisher } from "@solana-mobile/dapp-store-publishing-tools";
|
|
126
|
-
import { Connection, Keypair
|
|
127
|
-
import { Constants, getMetaplexInstance
|
|
126
|
+
import { Connection, Keypair } from "@solana/web3.js";
|
|
127
|
+
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
128
128
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
129
|
+
import { sendAndConfirmTransaction } from "../utils.js";
|
|
129
130
|
var createPublisherNft = function() {
|
|
130
131
|
var _ref = _async_to_generator(function(param) {
|
|
131
|
-
var connection, publisher, publisherDetails, storageParams, priorityFeeLamports, mintAddress, metaplex, txBuilder,
|
|
132
|
+
var connection, publisher, publisherDetails, storageParams, priorityFeeLamports, mintAddress, metaplex, txBuilder, response;
|
|
132
133
|
return _ts_generator(this, function(_state) {
|
|
133
134
|
switch(_state.label){
|
|
134
135
|
case 0:
|
|
@@ -150,71 +151,19 @@ var createPublisherNft = function() {
|
|
|
150
151
|
case 1:
|
|
151
152
|
txBuilder = _state.sent();
|
|
152
153
|
console.info("Publisher NFT data upload complete\nSigning transaction now");
|
|
153
|
-
maxTries = 8;
|
|
154
|
-
i = 1;
|
|
155
|
-
_state.label = 2;
|
|
156
|
-
case 2:
|
|
157
|
-
if (!(i <= maxTries)) return [
|
|
158
|
-
3,
|
|
159
|
-
8
|
|
160
|
-
];
|
|
161
|
-
_state.label = 3;
|
|
162
|
-
case 3:
|
|
163
|
-
_state.trys.push([
|
|
164
|
-
3,
|
|
165
|
-
6,
|
|
166
|
-
,
|
|
167
|
-
7
|
|
168
|
-
]);
|
|
169
154
|
return [
|
|
170
155
|
4,
|
|
171
|
-
|
|
172
|
-
];
|
|
173
|
-
case 4:
|
|
174
|
-
blockhash = _state.sent();
|
|
175
|
-
tx = txBuilder.toTransaction(blockhash.value);
|
|
176
|
-
tx.sign(mintAddress, publisher);
|
|
177
|
-
return [
|
|
178
|
-
4,
|
|
179
|
-
sendAndConfirmTransaction(connection, tx, [
|
|
180
|
-
publisher,
|
|
181
|
-
mintAddress
|
|
182
|
-
], {
|
|
183
|
-
commitment: "confirmed",
|
|
184
|
-
minContextSlot: blockhash.context.slot
|
|
185
|
-
})
|
|
156
|
+
sendAndConfirmTransaction(metaplex, txBuilder)
|
|
186
157
|
];
|
|
187
|
-
case
|
|
188
|
-
|
|
158
|
+
case 2:
|
|
159
|
+
response = _state.sent().response;
|
|
189
160
|
return [
|
|
190
161
|
2,
|
|
191
162
|
{
|
|
192
163
|
publisherAddress: mintAddress.publicKey.toBase58(),
|
|
193
|
-
transactionSignature:
|
|
164
|
+
transactionSignature: response.signature
|
|
194
165
|
}
|
|
195
166
|
];
|
|
196
|
-
case 6:
|
|
197
|
-
e = _state.sent();
|
|
198
|
-
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
199
|
-
if (i == maxTries) {
|
|
200
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
201
|
-
process.exit(-1);
|
|
202
|
-
} else {
|
|
203
|
-
retryMsg = errorMsg + "\nWill Retry minting publisher.";
|
|
204
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
205
|
-
}
|
|
206
|
-
return [
|
|
207
|
-
3,
|
|
208
|
-
7
|
|
209
|
-
];
|
|
210
|
-
case 7:
|
|
211
|
-
i++;
|
|
212
|
-
return [
|
|
213
|
-
3,
|
|
214
|
-
2
|
|
215
|
-
];
|
|
216
|
-
case 8:
|
|
217
|
-
throw new Error("Unable to mint publisher NFT");
|
|
218
167
|
}
|
|
219
168
|
});
|
|
220
169
|
});
|
|
@@ -230,8 +179,7 @@ export var createPublisherCommand = function() {
|
|
|
230
179
|
case 0:
|
|
231
180
|
signer = param.signer, url = param.url, dryRun = param.dryRun, storageParams = param.storageParams, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
|
|
232
181
|
connection = new Connection(url, {
|
|
233
|
-
commitment: "confirmed"
|
|
234
|
-
disableRetryOnRateLimit: true
|
|
182
|
+
commitment: "confirmed"
|
|
235
183
|
});
|
|
236
184
|
return [
|
|
237
185
|
4,
|
|
@@ -151,14 +151,15 @@ function _ts_generator(thisArg, body) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
import { createRelease } from "@solana-mobile/dapp-store-publishing-tools";
|
|
154
|
-
import { Connection, Keypair, PublicKey
|
|
154
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
155
155
|
import fs from "fs";
|
|
156
156
|
import { createHash } from "crypto";
|
|
157
|
-
import { Constants, getMetaplexInstance
|
|
157
|
+
import { Constants, getMetaplexInstance } from "../../CliUtils.js";
|
|
158
158
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
159
|
+
import { sendAndConfirmTransaction } from "../utils.js";
|
|
159
160
|
var createReleaseNft = function() {
|
|
160
161
|
var _ref = _async_to_generator(function(param) {
|
|
161
|
-
var appMintAddress, releaseDetails, appDetails, publisherDetails, connection, publisher, storageParams, priorityFeeLamports, releaseMintAddress, metaplex, txBuilder,
|
|
162
|
+
var appMintAddress, releaseDetails, appDetails, publisherDetails, connection, publisher, storageParams, priorityFeeLamports, releaseMintAddress, metaplex, txBuilder, response;
|
|
162
163
|
return _ts_generator(this, function(_state) {
|
|
163
164
|
switch(_state.label){
|
|
164
165
|
case 0:
|
|
@@ -183,71 +184,19 @@ var createReleaseNft = function() {
|
|
|
183
184
|
case 1:
|
|
184
185
|
txBuilder = _state.sent().txBuilder;
|
|
185
186
|
console.info("Release NFT data upload complete\nSigning transaction now");
|
|
186
|
-
maxTries = 8;
|
|
187
|
-
i = 1;
|
|
188
|
-
_state.label = 2;
|
|
189
|
-
case 2:
|
|
190
|
-
if (!(i <= maxTries)) return [
|
|
191
|
-
3,
|
|
192
|
-
8
|
|
193
|
-
];
|
|
194
|
-
_state.label = 3;
|
|
195
|
-
case 3:
|
|
196
|
-
_state.trys.push([
|
|
197
|
-
3,
|
|
198
|
-
6,
|
|
199
|
-
,
|
|
200
|
-
7
|
|
201
|
-
]);
|
|
202
187
|
return [
|
|
203
188
|
4,
|
|
204
|
-
|
|
189
|
+
sendAndConfirmTransaction(metaplex, txBuilder)
|
|
205
190
|
];
|
|
206
|
-
case
|
|
207
|
-
|
|
208
|
-
tx = txBuilder.toTransaction(blockhash.value);
|
|
209
|
-
tx.sign(releaseMintAddress, publisher);
|
|
210
|
-
return [
|
|
211
|
-
4,
|
|
212
|
-
sendAndConfirmTransaction(connection, tx, [
|
|
213
|
-
publisher,
|
|
214
|
-
releaseMintAddress
|
|
215
|
-
], {
|
|
216
|
-
commitment: "confirmed",
|
|
217
|
-
minContextSlot: blockhash.context.slot
|
|
218
|
-
})
|
|
219
|
-
];
|
|
220
|
-
case 5:
|
|
221
|
-
txSig = _state.sent();
|
|
191
|
+
case 2:
|
|
192
|
+
response = _state.sent().response;
|
|
222
193
|
return [
|
|
223
194
|
2,
|
|
224
195
|
{
|
|
225
196
|
releaseAddress: releaseMintAddress.publicKey.toBase58(),
|
|
226
|
-
transactionSignature:
|
|
197
|
+
transactionSignature: response.signature
|
|
227
198
|
}
|
|
228
199
|
];
|
|
229
|
-
case 6:
|
|
230
|
-
e = _state.sent();
|
|
231
|
-
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
232
|
-
if (i == maxTries) {
|
|
233
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
234
|
-
process.exit(-1);
|
|
235
|
-
} else {
|
|
236
|
-
retryMsg = errorMsg + "\nWill Retry minting release NFT";
|
|
237
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
238
|
-
}
|
|
239
|
-
return [
|
|
240
|
-
3,
|
|
241
|
-
7
|
|
242
|
-
];
|
|
243
|
-
case 7:
|
|
244
|
-
i++;
|
|
245
|
-
return [
|
|
246
|
-
3,
|
|
247
|
-
2
|
|
248
|
-
];
|
|
249
|
-
case 8:
|
|
250
|
-
throw new Error("Unable to mint release NFT");
|
|
251
200
|
}
|
|
252
201
|
});
|
|
253
202
|
});
|
|
@@ -263,8 +212,7 @@ export var createReleaseCommand = function() {
|
|
|
263
212
|
case 0:
|
|
264
213
|
appMintAddress = param.appMintAddress, buildToolsPath = param.buildToolsPath, signer = param.signer, url = param.url, _param_dryRun = param.dryRun, dryRun = _param_dryRun === void 0 ? false : _param_dryRun, storageParams = param.storageParams, _param_priorityFeeLamports = param.priorityFeeLamports, priorityFeeLamports = _param_priorityFeeLamports === void 0 ? Constants.DEFAULT_PRIORITY_FEE : _param_priorityFeeLamports;
|
|
265
214
|
connection = new Connection(url, {
|
|
266
|
-
commitment: "confirmed"
|
|
267
|
-
disableRetryOnRateLimit: true
|
|
215
|
+
commitment: "confirmed"
|
|
268
216
|
});
|
|
269
217
|
return [
|
|
270
218
|
4,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { dump } from "js-yaml";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type: "json"
|
|
5
|
-
};
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
var releaseSchema = JSON.parse((await readFile(new URL("../../generated/config_obj.json", import.meta.url))).toString());
|
|
6
4
|
import fs from "fs";
|
|
7
5
|
import { Constants } from "../../CliUtils.js";
|
|
8
6
|
export var initScaffold = function() {
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _instanceof(left, right) {
|
|
31
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
32
|
+
return !!right[Symbol.hasInstance](left);
|
|
33
|
+
} else {
|
|
34
|
+
return left instanceof right;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function _ts_generator(thisArg, body) {
|
|
38
|
+
var f, y, t, g, _ = {
|
|
39
|
+
label: 0,
|
|
40
|
+
sent: function() {
|
|
41
|
+
if (t[0] & 1) throw t[1];
|
|
42
|
+
return t[1];
|
|
43
|
+
},
|
|
44
|
+
trys: [],
|
|
45
|
+
ops: []
|
|
46
|
+
};
|
|
47
|
+
return g = {
|
|
48
|
+
next: verb(0),
|
|
49
|
+
"throw": verb(1),
|
|
50
|
+
"return": verb(2)
|
|
51
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
52
|
+
return this;
|
|
53
|
+
}), g;
|
|
54
|
+
function verb(n) {
|
|
55
|
+
return function(v) {
|
|
56
|
+
return step([
|
|
57
|
+
n,
|
|
58
|
+
v
|
|
59
|
+
]);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function step(op) {
|
|
63
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
64
|
+
while(_)try {
|
|
65
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
66
|
+
if (y = 0, t) op = [
|
|
67
|
+
op[0] & 2,
|
|
68
|
+
t.value
|
|
69
|
+
];
|
|
70
|
+
switch(op[0]){
|
|
71
|
+
case 0:
|
|
72
|
+
case 1:
|
|
73
|
+
t = op;
|
|
74
|
+
break;
|
|
75
|
+
case 4:
|
|
76
|
+
_.label++;
|
|
77
|
+
return {
|
|
78
|
+
value: op[1],
|
|
79
|
+
done: false
|
|
80
|
+
};
|
|
81
|
+
case 5:
|
|
82
|
+
_.label++;
|
|
83
|
+
y = op[1];
|
|
84
|
+
op = [
|
|
85
|
+
0
|
|
86
|
+
];
|
|
87
|
+
continue;
|
|
88
|
+
case 7:
|
|
89
|
+
op = _.ops.pop();
|
|
90
|
+
_.trys.pop();
|
|
91
|
+
continue;
|
|
92
|
+
default:
|
|
93
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
94
|
+
_ = 0;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
98
|
+
_.label = op[1];
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
102
|
+
_.label = t[1];
|
|
103
|
+
t = op;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (t && _.label < t[2]) {
|
|
107
|
+
_.label = t[2];
|
|
108
|
+
_.ops.push(op);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
if (t[2]) _.ops.pop();
|
|
112
|
+
_.trys.pop();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
op = body.call(thisArg, _);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
op = [
|
|
118
|
+
6,
|
|
119
|
+
e
|
|
120
|
+
];
|
|
121
|
+
y = 0;
|
|
122
|
+
} finally{
|
|
123
|
+
f = t = 0;
|
|
124
|
+
}
|
|
125
|
+
if (op[0] & 5) throw op[1];
|
|
126
|
+
return {
|
|
127
|
+
value: op[0] ? op[1] : void 0,
|
|
128
|
+
done: true
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
import { FailedToConfirmTransactionError } from "@metaplex-foundation/js";
|
|
133
|
+
import { TransactionExpiredBlockheightExceededError } from "@solana/web3.js";
|
|
134
|
+
export function sendAndConfirmTransaction(metaplex, builder) {
|
|
135
|
+
return _sendAndConfirmTransaction.apply(this, arguments);
|
|
136
|
+
}
|
|
137
|
+
function _sendAndConfirmTransaction() {
|
|
138
|
+
_sendAndConfirmTransaction = _async_to_generator(function(metaplex, builder) {
|
|
139
|
+
var i, e;
|
|
140
|
+
return _ts_generator(this, function(_state) {
|
|
141
|
+
switch(_state.label){
|
|
142
|
+
case 0:
|
|
143
|
+
i = 0;
|
|
144
|
+
_state.label = 1;
|
|
145
|
+
case 1:
|
|
146
|
+
if (!(i < 10)) return [
|
|
147
|
+
3,
|
|
148
|
+
6
|
|
149
|
+
];
|
|
150
|
+
_state.label = 2;
|
|
151
|
+
case 2:
|
|
152
|
+
_state.trys.push([
|
|
153
|
+
2,
|
|
154
|
+
4,
|
|
155
|
+
,
|
|
156
|
+
5
|
|
157
|
+
]);
|
|
158
|
+
return [
|
|
159
|
+
4,
|
|
160
|
+
builder.sendAndConfirm(metaplex)
|
|
161
|
+
];
|
|
162
|
+
case 3:
|
|
163
|
+
return [
|
|
164
|
+
2,
|
|
165
|
+
_state.sent()
|
|
166
|
+
];
|
|
167
|
+
case 4:
|
|
168
|
+
e = _state.sent();
|
|
169
|
+
if (isTransientError(e)) {
|
|
170
|
+
return [
|
|
171
|
+
3,
|
|
172
|
+
5
|
|
173
|
+
];
|
|
174
|
+
}
|
|
175
|
+
throw e;
|
|
176
|
+
case 5:
|
|
177
|
+
i++;
|
|
178
|
+
return [
|
|
179
|
+
3,
|
|
180
|
+
1
|
|
181
|
+
];
|
|
182
|
+
case 6:
|
|
183
|
+
throw new Error("Unable to send transaction. Please try later.");
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
return _sendAndConfirmTransaction.apply(this, arguments);
|
|
188
|
+
}
|
|
189
|
+
function isTransientError(e) {
|
|
190
|
+
var _e_cause;
|
|
191
|
+
var _e_cause_message;
|
|
192
|
+
return _instanceof(e, FailedToConfirmTransactionError) && (_instanceof(e.cause, TransactionExpiredBlockheightExceededError) || /blockhash not found/i.test((_e_cause_message = (_e_cause = e.cause) === null || _e_cause === void 0 ? void 0 : _e_cause.message) !== null && _e_cause_message !== void 0 ? _e_cause_message : ""));
|
|
193
|
+
}
|
|
@@ -209,9 +209,8 @@ function _ts_generator(thisArg, body) {
|
|
|
209
209
|
import { dump, load } from "js-yaml";
|
|
210
210
|
import Ajv from "ajv";
|
|
211
211
|
// eslint-disable-next-line require-extensions/require-extensions
|
|
212
|
-
import
|
|
213
|
-
|
|
214
|
-
};
|
|
212
|
+
import { readFile } from "fs/promises";
|
|
213
|
+
var schemaJson = JSON.parse((await readFile(new URL("../generated/config_schema.json", import.meta.url))).toString());
|
|
215
214
|
import fs from "fs";
|
|
216
215
|
import path from "path";
|
|
217
216
|
import { toMetaplexFile } from "@metaplex-foundation/js";
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/dapp-store-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@aws-sdk/client-s3": "^3.321.1",
|
|
55
55
|
"@metaplex-foundation/js-plugin-aws": "^0.20.0",
|
|
56
|
-
"@solana-mobile/dapp-store-publishing-tools": "workspace:0.9.
|
|
57
|
-
"@solana/web3.js": "1.
|
|
56
|
+
"@solana-mobile/dapp-store-publishing-tools": "workspace:0.9.3",
|
|
57
|
+
"@solana/web3.js": "1.92.1",
|
|
58
58
|
"@types/semver": "^7.3.13",
|
|
59
59
|
"ajv": "^8.11.0",
|
|
60
60
|
"boxen": "^7.0.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/dapp-store-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@aws-sdk/client-s3": "^3.321.1",
|
|
48
48
|
"@metaplex-foundation/js-plugin-aws": "^0.20.0",
|
|
49
|
-
"@solana-mobile/dapp-store-publishing-tools": "0.9.
|
|
50
|
-
"@solana/web3.js": "1.
|
|
49
|
+
"@solana-mobile/dapp-store-publishing-tools": "0.9.3",
|
|
50
|
+
"@solana/web3.js": "1.92.1",
|
|
51
51
|
"@types/semver": "^7.3.13",
|
|
52
52
|
"ajv": "^8.11.0",
|
|
53
53
|
"boxen": "^7.0.1",
|
package/src/CliUtils.ts
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
Metaplex,
|
|
9
9
|
} from "@metaplex-foundation/js";
|
|
10
10
|
import updateNotifier from "update-notifier";
|
|
11
|
-
import
|
|
11
|
+
import { readFile } from 'fs/promises';
|
|
12
|
+
const cliPackage = JSON.parse((await readFile(new URL("./package.json", import.meta.url))).toString());
|
|
12
13
|
import boxen from "boxen";
|
|
13
14
|
import ver from "semver";
|
|
14
15
|
import { CachedStorageDriver } from "./upload/CachedStorageDriver.js";
|
|
@@ -18,7 +19,7 @@ import { awsStorage } from "@metaplex-foundation/js-plugin-aws";
|
|
|
18
19
|
import { S3StorageManager } from "./config/index.js";
|
|
19
20
|
|
|
20
21
|
export class Constants {
|
|
21
|
-
static CLI_VERSION = "0.9.
|
|
22
|
+
static CLI_VERSION = "0.9.3";
|
|
22
23
|
static CONFIG_FILE_NAME = "config.yaml";
|
|
23
24
|
static DEFAULT_RPC_DEVNET = "https://api.devnet.solana.com";
|
|
24
25
|
static DEFAULT_PRIORITY_FEE = 500000;
|
|
@@ -59,13 +60,28 @@ export const checkMintedStatus = async (
|
|
|
59
60
|
new PublicKey(releaseAddr),
|
|
60
61
|
]);
|
|
61
62
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const isPublisherMinted = results[0] != undefined && results[0]?.lamports > 0
|
|
64
|
+
const isAppMinted = results[1] != undefined && results[1]?.lamports > 0
|
|
65
|
+
const isReleaseMinted = results[2] != undefined && results[2]?.lamports > 0
|
|
66
|
+
|
|
67
|
+
if (!isPublisherMinted || !isAppMinted || !isReleaseMinted) {
|
|
68
|
+
let errorMessage = ``
|
|
69
|
+
|
|
70
|
+
if (!isPublisherMinted) {
|
|
71
|
+
errorMessage = errorMessage + `Publisher NFT fetch at address ${pubAddr} failed.\n`
|
|
72
|
+
}
|
|
73
|
+
if (!isAppMinted) {
|
|
74
|
+
errorMessage = errorMessage + `App NFT fetch at address ${appAddr} failed.\n`
|
|
75
|
+
}
|
|
76
|
+
if (!isReleaseMinted) {
|
|
77
|
+
errorMessage = errorMessage + `Release NFT fetch at address ${releaseAddr} failed.\n`
|
|
78
|
+
}
|
|
79
|
+
|
|
66
80
|
throw new Error(
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
`Expected Publisher :: ${pubAddr}, App :: ${appAddr} and Release :: ${releaseAddr} to be minted before submission.\n
|
|
82
|
+
but ${errorMessage}\n
|
|
83
|
+
Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal.`
|
|
84
|
+
);
|
|
69
85
|
}
|
|
70
86
|
};
|
|
71
87
|
|
|
@@ -4,15 +4,14 @@ import {
|
|
|
4
4
|
Connection,
|
|
5
5
|
Keypair,
|
|
6
6
|
PublicKey,
|
|
7
|
-
sendAndConfirmTransaction,
|
|
8
7
|
} from "@solana/web3.js";
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
Constants,
|
|
12
11
|
getMetaplexInstance,
|
|
13
|
-
showMessage,
|
|
14
12
|
} from "../../CliUtils.js";
|
|
15
13
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
14
|
+
import { sendAndConfirmTransaction } from "../utils.js";
|
|
16
15
|
|
|
17
16
|
const createAppNft = async (
|
|
18
17
|
{
|
|
@@ -46,33 +45,13 @@ const createAppNft = async (
|
|
|
46
45
|
);
|
|
47
46
|
|
|
48
47
|
console.info(`App NFT data upload complete\nSigning transaction now`);
|
|
49
|
-
const maxTries = 8;
|
|
50
|
-
for (let i = 1; i <= maxTries; i++) {
|
|
51
|
-
try {
|
|
52
|
-
const blockhash = await connection.getLatestBlockhashAndContext();
|
|
53
|
-
const tx = txBuilder.toTransaction(blockhash.value);
|
|
54
|
-
tx.sign(mintAddress, publisher);
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
return { appAddress: mintAddress.publicKey.toBase58(), transactionSignature: txSig };
|
|
64
|
-
} catch (e) {
|
|
65
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
66
|
-
if (i == maxTries) {
|
|
67
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
68
|
-
process.exit(-1)
|
|
69
|
-
} else {
|
|
70
|
-
const retryMsg = errorMsg + "\nWill Retry minting app NFT."
|
|
71
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
throw new Error("Unable to mint app NFT");
|
|
49
|
+
const { response } = await sendAndConfirmTransaction(metaplex, txBuilder);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
appAddress: mintAddress.publicKey.toBase58(),
|
|
53
|
+
transactionSignature: response.signature,
|
|
54
|
+
};
|
|
76
55
|
};
|
|
77
56
|
|
|
78
57
|
type CreateAppCommandInput = {
|
|
@@ -96,7 +75,6 @@ export const createAppCommand = async ({
|
|
|
96
75
|
url,
|
|
97
76
|
{
|
|
98
77
|
commitment: "confirmed",
|
|
99
|
-
disableRetryOnRateLimit: true,
|
|
100
78
|
}
|
|
101
79
|
);
|
|
102
80
|
|
|
@@ -3,15 +3,14 @@ import { createPublisher } from "@solana-mobile/dapp-store-publishing-tools";
|
|
|
3
3
|
import {
|
|
4
4
|
Connection,
|
|
5
5
|
Keypair,
|
|
6
|
-
sendAndConfirmTransaction,
|
|
7
6
|
} from "@solana/web3.js";
|
|
8
7
|
|
|
9
8
|
import {
|
|
10
9
|
Constants,
|
|
11
10
|
getMetaplexInstance,
|
|
12
|
-
showMessage,
|
|
13
11
|
} from "../../CliUtils.js";
|
|
14
12
|
import { loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
13
|
+
import { sendAndConfirmTransaction } from "../utils.js";
|
|
15
14
|
|
|
16
15
|
const createPublisherNft = async (
|
|
17
16
|
{
|
|
@@ -37,33 +36,13 @@ const createPublisherNft = async (
|
|
|
37
36
|
);
|
|
38
37
|
|
|
39
38
|
console.info(`Publisher NFT data upload complete\nSigning transaction now`);
|
|
40
|
-
const maxTries = 8;
|
|
41
|
-
for (let i = 1; i <= maxTries; i++) {
|
|
42
|
-
try {
|
|
43
|
-
const blockhash = await connection.getLatestBlockhashAndContext();
|
|
44
|
-
const tx = txBuilder.toTransaction(blockhash.value);
|
|
45
|
-
tx.sign(mintAddress, publisher);
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
return { publisherAddress: mintAddress.publicKey.toBase58(), transactionSignature: txSig};
|
|
55
|
-
} catch (e) {
|
|
56
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
57
|
-
if (i == maxTries) {
|
|
58
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
59
|
-
process.exit(-1)
|
|
60
|
-
} else {
|
|
61
|
-
const retryMsg = errorMsg + "\nWill Retry minting publisher."
|
|
62
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
throw new Error("Unable to mint publisher NFT");
|
|
40
|
+
const { response } = await sendAndConfirmTransaction(metaplex, txBuilder);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
publisherAddress: mintAddress.publicKey.toBase58(),
|
|
44
|
+
transactionSignature: response.signature,
|
|
45
|
+
};
|
|
67
46
|
};
|
|
68
47
|
|
|
69
48
|
export const createPublisherCommand = async ({
|
|
@@ -83,7 +62,6 @@ export const createPublisherCommand = async ({
|
|
|
83
62
|
url,
|
|
84
63
|
{
|
|
85
64
|
commitment: "confirmed",
|
|
86
|
-
disableRetryOnRateLimit: true,
|
|
87
65
|
}
|
|
88
66
|
);
|
|
89
67
|
|
|
@@ -8,16 +8,15 @@ import {
|
|
|
8
8
|
Connection,
|
|
9
9
|
Keypair,
|
|
10
10
|
PublicKey,
|
|
11
|
-
sendAndConfirmTransaction,
|
|
12
11
|
} from "@solana/web3.js";
|
|
13
12
|
import fs from "fs";
|
|
14
13
|
import { createHash } from "crypto";
|
|
15
14
|
import {
|
|
16
15
|
Constants,
|
|
17
16
|
getMetaplexInstance,
|
|
18
|
-
showMessage
|
|
19
17
|
} from "../../CliUtils.js";
|
|
20
18
|
import { PublishDetails, loadPublishDetailsWithChecks, writeToPublishDetails } from "../../config/PublishDetails.js";
|
|
19
|
+
import { sendAndConfirmTransaction } from "../utils.js";
|
|
21
20
|
|
|
22
21
|
type CreateReleaseCommandInput = {
|
|
23
22
|
appMintAddress: string;
|
|
@@ -67,32 +66,13 @@ const createReleaseNft = async ({
|
|
|
67
66
|
);
|
|
68
67
|
|
|
69
68
|
console.info(`Release NFT data upload complete\nSigning transaction now`);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
publisher,
|
|
78
|
-
releaseMintAddress,
|
|
79
|
-
], {
|
|
80
|
-
commitment: "confirmed",
|
|
81
|
-
minContextSlot: blockhash.context.slot,
|
|
82
|
-
});
|
|
83
|
-
return { releaseAddress: releaseMintAddress.publicKey.toBase58(), transactionSignature: txSig };
|
|
84
|
-
} catch (e) {
|
|
85
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
86
|
-
if (i == maxTries) {
|
|
87
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
88
|
-
process.exit(-1)
|
|
89
|
-
} else {
|
|
90
|
-
const retryMsg = errorMsg + "\nWill Retry minting release NFT"
|
|
91
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
throw new Error("Unable to mint release NFT");
|
|
69
|
+
|
|
70
|
+
const { response } = await sendAndConfirmTransaction(metaplex, txBuilder);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
releaseAddress: releaseMintAddress.publicKey.toBase58(),
|
|
74
|
+
transactionSignature: response.signature,
|
|
75
|
+
};
|
|
96
76
|
};
|
|
97
77
|
|
|
98
78
|
export const createReleaseCommand = async ({
|
|
@@ -108,7 +88,6 @@ export const createReleaseCommand = async ({
|
|
|
108
88
|
url,
|
|
109
89
|
{
|
|
110
90
|
commitment: "confirmed",
|
|
111
|
-
disableRetryOnRateLimit: true,
|
|
112
91
|
}
|
|
113
92
|
);
|
|
114
93
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import yaml, { dump } from "js-yaml";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
const releaseSchema = JSON.parse((await readFile(new URL("../../generated/config_obj.json", import.meta.url))).toString());
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import { Constants } from "../../CliUtils.js";
|
|
7
7
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Metaplex,
|
|
3
|
+
type TransactionBuilder,
|
|
4
|
+
FailedToConfirmTransactionError,
|
|
5
|
+
} from "@metaplex-foundation/js";
|
|
6
|
+
import { TransactionExpiredBlockheightExceededError } from "@solana/web3.js";
|
|
7
|
+
|
|
8
|
+
export async function sendAndConfirmTransaction(
|
|
9
|
+
metaplex: Metaplex,
|
|
10
|
+
builder: TransactionBuilder
|
|
11
|
+
): ReturnType<TransactionBuilder["sendAndConfirm"]> {
|
|
12
|
+
for (let i = 0; i < 10; i++) {
|
|
13
|
+
try {
|
|
14
|
+
return await builder.sendAndConfirm(metaplex);
|
|
15
|
+
} catch (e: unknown) {
|
|
16
|
+
if (isTransientError(e)) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
throw e;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
throw new Error("Unable to send transaction. Please try later.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isTransientError(e: unknown): boolean {
|
|
28
|
+
return (
|
|
29
|
+
e instanceof FailedToConfirmTransactionError &&
|
|
30
|
+
(e.cause instanceof TransactionExpiredBlockheightExceededError ||
|
|
31
|
+
/blockhash not found/i.test(e.cause?.message ?? ""))
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -10,7 +10,8 @@ import type {
|
|
|
10
10
|
import { dump, load } from "js-yaml";
|
|
11
11
|
import Ajv from "ajv";
|
|
12
12
|
// eslint-disable-next-line require-extensions/require-extensions
|
|
13
|
-
import
|
|
13
|
+
import { readFile } from 'fs/promises';
|
|
14
|
+
const schemaJson = JSON.parse((await readFile(new URL("../generated/config_schema.json", import.meta.url))).toString());
|
|
14
15
|
import fs from "fs";
|
|
15
16
|
import path from "path";
|
|
16
17
|
import { toMetaplexFile } from "@metaplex-foundation/js";
|