@solana-mobile/dapp-store-cli 0.9.0 → 0.9.2
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/lib/CliUtils.js +1 -1
- package/lib/commands/create/CreateCliApp.js +11 -59
- package/lib/commands/create/CreateCliPublisher.js +11 -59
- package/lib/commands/create/CreateCliRelease.js +11 -59
- package/lib/commands/utils.js +193 -0
- package/lib/config/PublishDetails.js +2 -2
- package/lib/package.json +3 -3
- package/package.json +3 -3
- package/src/CliUtils.ts +1 -1
- package/src/commands/create/CreateCliApp.ts +13 -28
- package/src/commands/create/CreateCliPublisher.ts +13 -28
- package/src/commands/create/CreateCliRelease.ts +14 -28
- package/src/commands/utils.ts +33 -0
- package/src/config/PublishDetails.ts +2 -2
package/lib/CliUtils.js
CHANGED
|
@@ -159,7 +159,7 @@ export var Constants = function Constants() {
|
|
|
159
159
|
"use strict";
|
|
160
160
|
_class_call_check(this, Constants);
|
|
161
161
|
};
|
|
162
|
-
_define_property(Constants, "CLI_VERSION", "0.9.
|
|
162
|
+
_define_property(Constants, "CLI_VERSION", "0.9.2");
|
|
163
163
|
_define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
|
|
164
164
|
_define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
|
|
165
165
|
_define_property(Constants, "DEFAULT_PRIORITY_FEE", 500000);
|
|
@@ -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,70 +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
|
-
minContextSlot: blockhash.context.slot
|
|
185
|
-
})
|
|
186
|
-
];
|
|
187
|
-
case 5:
|
|
188
|
-
txSig = _state.sent();
|
|
159
|
+
case 2:
|
|
160
|
+
response = _state.sent().response;
|
|
189
161
|
return [
|
|
190
162
|
2,
|
|
191
163
|
{
|
|
192
164
|
appAddress: mintAddress.publicKey.toBase58(),
|
|
193
|
-
transactionSignature:
|
|
165
|
+
transactionSignature: response.signature
|
|
194
166
|
}
|
|
195
167
|
];
|
|
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 app NFT.";
|
|
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 app NFT");
|
|
218
168
|
}
|
|
219
169
|
});
|
|
220
170
|
});
|
|
@@ -229,7 +179,9 @@ export var createAppCommand = function() {
|
|
|
229
179
|
switch(_state.label){
|
|
230
180
|
case 0:
|
|
231
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;
|
|
232
|
-
connection = new Connection(url
|
|
182
|
+
connection = new Connection(url, {
|
|
183
|
+
commitment: "confirmed"
|
|
184
|
+
});
|
|
233
185
|
return [
|
|
234
186
|
4,
|
|
235
187
|
loadPublishDetailsWithChecks()
|
|
@@ -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,70 +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
|
-
minContextSlot: blockhash.context.slot
|
|
184
|
-
})
|
|
156
|
+
sendAndConfirmTransaction(metaplex, txBuilder)
|
|
185
157
|
];
|
|
186
|
-
case
|
|
187
|
-
|
|
158
|
+
case 2:
|
|
159
|
+
response = _state.sent().response;
|
|
188
160
|
return [
|
|
189
161
|
2,
|
|
190
162
|
{
|
|
191
163
|
publisherAddress: mintAddress.publicKey.toBase58(),
|
|
192
|
-
transactionSignature:
|
|
164
|
+
transactionSignature: response.signature
|
|
193
165
|
}
|
|
194
166
|
];
|
|
195
|
-
case 6:
|
|
196
|
-
e = _state.sent();
|
|
197
|
-
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
198
|
-
if (i == maxTries) {
|
|
199
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
200
|
-
process.exit(-1);
|
|
201
|
-
} else {
|
|
202
|
-
retryMsg = errorMsg + "\nWill Retry minting publisher.";
|
|
203
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
204
|
-
}
|
|
205
|
-
return [
|
|
206
|
-
3,
|
|
207
|
-
7
|
|
208
|
-
];
|
|
209
|
-
case 7:
|
|
210
|
-
i++;
|
|
211
|
-
return [
|
|
212
|
-
3,
|
|
213
|
-
2
|
|
214
|
-
];
|
|
215
|
-
case 8:
|
|
216
|
-
throw new Error("Unable to mint publisher NFT");
|
|
217
167
|
}
|
|
218
168
|
});
|
|
219
169
|
});
|
|
@@ -228,7 +178,9 @@ export var createPublisherCommand = function() {
|
|
|
228
178
|
switch(_state.label){
|
|
229
179
|
case 0:
|
|
230
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;
|
|
231
|
-
connection = new Connection(url
|
|
181
|
+
connection = new Connection(url, {
|
|
182
|
+
commitment: "confirmed"
|
|
183
|
+
});
|
|
232
184
|
return [
|
|
233
185
|
4,
|
|
234
186
|
loadPublishDetailsWithChecks()
|
|
@@ -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,70 +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
|
-
minContextSlot: blockhash.context.slot
|
|
217
|
-
})
|
|
218
|
-
];
|
|
219
|
-
case 5:
|
|
220
|
-
txSig = _state.sent();
|
|
191
|
+
case 2:
|
|
192
|
+
response = _state.sent().response;
|
|
221
193
|
return [
|
|
222
194
|
2,
|
|
223
195
|
{
|
|
224
196
|
releaseAddress: releaseMintAddress.publicKey.toBase58(),
|
|
225
|
-
transactionSignature:
|
|
197
|
+
transactionSignature: response.signature
|
|
226
198
|
}
|
|
227
199
|
];
|
|
228
|
-
case 6:
|
|
229
|
-
e = _state.sent();
|
|
230
|
-
errorMsg = (_e_message = e === null || e === void 0 ? void 0 : e.message) !== null && _e_message !== void 0 ? _e_message : "";
|
|
231
|
-
if (i == maxTries) {
|
|
232
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
233
|
-
process.exit(-1);
|
|
234
|
-
} else {
|
|
235
|
-
retryMsg = errorMsg + "\nWill Retry minting release NFT";
|
|
236
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
237
|
-
}
|
|
238
|
-
return [
|
|
239
|
-
3,
|
|
240
|
-
7
|
|
241
|
-
];
|
|
242
|
-
case 7:
|
|
243
|
-
i++;
|
|
244
|
-
return [
|
|
245
|
-
3,
|
|
246
|
-
2
|
|
247
|
-
];
|
|
248
|
-
case 8:
|
|
249
|
-
throw new Error("Unable to mint release NFT");
|
|
250
200
|
}
|
|
251
201
|
});
|
|
252
202
|
});
|
|
@@ -261,7 +211,9 @@ export var createReleaseCommand = function() {
|
|
|
261
211
|
switch(_state.label){
|
|
262
212
|
case 0:
|
|
263
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;
|
|
264
|
-
connection = new Connection(url
|
|
214
|
+
connection = new Connection(url, {
|
|
215
|
+
commitment: "confirmed"
|
|
216
|
+
});
|
|
265
217
|
return [
|
|
266
218
|
4,
|
|
267
219
|
loadPublishDetailsWithChecks(buildToolsPath)
|
|
@@ -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
|
+
}
|
|
@@ -228,7 +228,7 @@ var AaptPrefixes = {
|
|
|
228
228
|
packagePrefix: "package: name=",
|
|
229
229
|
verCodePrefix: "versionCode=",
|
|
230
230
|
verNamePrefix: "versionName=",
|
|
231
|
-
sdkPrefix: "
|
|
231
|
+
sdkPrefix: "(?:minSdk|sdk)Version:",
|
|
232
232
|
debuggableApkPrefix: "application-debuggable",
|
|
233
233
|
localePrefix: "locales: "
|
|
234
234
|
};
|
|
@@ -670,7 +670,7 @@ var getAndroidDetails = function() {
|
|
|
670
670
|
versionCode = new RegExp(AaptPrefixes.verCodePrefix + AaptPrefixes.quoteRegex).exec(stdout);
|
|
671
671
|
versionName = new RegExp(AaptPrefixes.verNamePrefix + AaptPrefixes.quoteRegex).exec(stdout);
|
|
672
672
|
minSdk = new RegExp(AaptPrefixes.sdkPrefix + AaptPrefixes.quoteRegex).exec(stdout);
|
|
673
|
-
permissions = _to_consumable_array(stdout.matchAll(/uses-permission: name='(
|
|
673
|
+
permissions = _to_consumable_array(stdout.matchAll(/(?:uses-permission|uses-permission-sdk-23): name='([^']*)'/g)).flatMap(function(permission) {
|
|
674
674
|
return permission[1];
|
|
675
675
|
});
|
|
676
676
|
locales = new RegExp(AaptPrefixes.localePrefix + AaptPrefixes.quoteNonLazyRegex).exec(stdout);
|
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.2",
|
|
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.2",
|
|
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.2",
|
|
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.2",
|
|
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
|
@@ -18,7 +18,7 @@ import { awsStorage } from "@metaplex-foundation/js-plugin-aws";
|
|
|
18
18
|
import { S3StorageManager } from "./config/index.js";
|
|
19
19
|
|
|
20
20
|
export class Constants {
|
|
21
|
-
static CLI_VERSION = "0.9.
|
|
21
|
+
static CLI_VERSION = "0.9.2";
|
|
22
22
|
static CONFIG_FILE_NAME = "config.yaml";
|
|
23
23
|
static DEFAULT_RPC_DEVNET = "https://api.devnet.solana.com";
|
|
24
24
|
static DEFAULT_PRIORITY_FEE = 500000;
|
|
@@ -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,32 +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
|
-
return { appAddress: mintAddress.publicKey.toBase58(), transactionSignature: txSig };
|
|
63
|
-
} catch (e) {
|
|
64
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
65
|
-
if (i == maxTries) {
|
|
66
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
67
|
-
process.exit(-1)
|
|
68
|
-
} else {
|
|
69
|
-
const retryMsg = errorMsg + "\nWill Retry minting app NFT."
|
|
70
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
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
|
+
};
|
|
75
55
|
};
|
|
76
56
|
|
|
77
57
|
type CreateAppCommandInput = {
|
|
@@ -91,7 +71,12 @@ export const createAppCommand = async ({
|
|
|
91
71
|
storageParams,
|
|
92
72
|
priorityFeeLamports = Constants.DEFAULT_PRIORITY_FEE,
|
|
93
73
|
}: CreateAppCommandInput) => {
|
|
94
|
-
const connection = new Connection(
|
|
74
|
+
const connection = new Connection(
|
|
75
|
+
url,
|
|
76
|
+
{
|
|
77
|
+
commitment: "confirmed",
|
|
78
|
+
}
|
|
79
|
+
);
|
|
95
80
|
|
|
96
81
|
const { app: appDetails, publisher: publisherDetails } =
|
|
97
82
|
await loadPublishDetailsWithChecks();
|
|
@@ -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,32 +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
|
-
return { publisherAddress: mintAddress.publicKey.toBase58(), transactionSignature: txSig};
|
|
54
|
-
} catch (e) {
|
|
55
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
56
|
-
if (i == maxTries) {
|
|
57
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
58
|
-
process.exit(-1)
|
|
59
|
-
} else {
|
|
60
|
-
const retryMsg = errorMsg + "\nWill Retry minting publisher."
|
|
61
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
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
|
+
};
|
|
66
46
|
};
|
|
67
47
|
|
|
68
48
|
export const createPublisherCommand = async ({
|
|
@@ -78,7 +58,12 @@ export const createPublisherCommand = async ({
|
|
|
78
58
|
storageParams: string;
|
|
79
59
|
priorityFeeLamports: number;
|
|
80
60
|
}) => {
|
|
81
|
-
const connection = new Connection(
|
|
61
|
+
const connection = new Connection(
|
|
62
|
+
url,
|
|
63
|
+
{
|
|
64
|
+
commitment: "confirmed",
|
|
65
|
+
}
|
|
66
|
+
);
|
|
82
67
|
|
|
83
68
|
const { publisher: publisherDetails } = await loadPublishDetailsWithChecks();
|
|
84
69
|
|
|
@@ -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,31 +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
|
-
minContextSlot: blockhash.context.slot,
|
|
81
|
-
});
|
|
82
|
-
return { releaseAddress: releaseMintAddress.publicKey.toBase58(), transactionSignature: txSig };
|
|
83
|
-
} catch (e) {
|
|
84
|
-
const errorMsg = (e as Error | null)?.message ?? "";
|
|
85
|
-
if (i == maxTries) {
|
|
86
|
-
showMessage("Transaction Failure", errorMsg, "error");
|
|
87
|
-
process.exit(-1)
|
|
88
|
-
} else {
|
|
89
|
-
const retryMsg = errorMsg + "\nWill Retry minting release NFT"
|
|
90
|
-
showMessage("Transaction Failure", retryMsg, "standard");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
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
|
+
};
|
|
95
76
|
};
|
|
96
77
|
|
|
97
78
|
export const createReleaseCommand = async ({
|
|
@@ -103,7 +84,12 @@ export const createReleaseCommand = async ({
|
|
|
103
84
|
storageParams,
|
|
104
85
|
priorityFeeLamports = Constants.DEFAULT_PRIORITY_FEE,
|
|
105
86
|
}: CreateReleaseCommandInput) => {
|
|
106
|
-
const connection = new Connection(
|
|
87
|
+
const connection = new Connection(
|
|
88
|
+
url,
|
|
89
|
+
{
|
|
90
|
+
commitment: "confirmed",
|
|
91
|
+
}
|
|
92
|
+
);
|
|
107
93
|
|
|
108
94
|
const config = await loadPublishDetailsWithChecks(buildToolsPath);
|
|
109
95
|
|
|
@@ -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
|
+
}
|
|
@@ -38,7 +38,7 @@ const AaptPrefixes = {
|
|
|
38
38
|
packagePrefix: "package: name=",
|
|
39
39
|
verCodePrefix: "versionCode=",
|
|
40
40
|
verNamePrefix: "versionName=",
|
|
41
|
-
sdkPrefix: "
|
|
41
|
+
sdkPrefix: "(?:minSdk|sdk)Version:",
|
|
42
42
|
debuggableApkPrefix: "application-debuggable",
|
|
43
43
|
localePrefix: "locales: ",
|
|
44
44
|
};
|
|
@@ -272,7 +272,7 @@ const getAndroidDetails = async (
|
|
|
272
272
|
const minSdk = new RegExp(
|
|
273
273
|
AaptPrefixes.sdkPrefix + AaptPrefixes.quoteRegex
|
|
274
274
|
).exec(stdout);
|
|
275
|
-
const permissions = [...stdout.matchAll(/uses-permission: name='(
|
|
275
|
+
const permissions = [...stdout.matchAll(/(?:uses-permission|uses-permission-sdk-23): name='([^']*)'/g)].flatMap(permission => permission[1]);
|
|
276
276
|
const locales = new RegExp(
|
|
277
277
|
AaptPrefixes.localePrefix + AaptPrefixes.quoteNonLazyRegex
|
|
278
278
|
).exec(stdout);
|