permaweb-deploy 2.5.0 → 3.0.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/README.md +311 -83
- package/bin/dev.js +5 -0
- package/bin/run.js +5 -0
- package/dist/commands/deploy.js +227 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/constants/flags.js +190 -0
- package/dist/constants/flags.js.map +1 -0
- package/dist/index.js +2 -299
- package/dist/index.js.map +1 -0
- package/dist/prompts/arns.js +89 -0
- package/dist/prompts/arns.js.map +1 -0
- package/dist/prompts/deployment.js +27 -0
- package/dist/prompts/deployment.js.map +1 -0
- package/dist/prompts/wallet.js +51 -0
- package/dist/prompts/wallet.js.map +1 -0
- package/dist/src/commands/deploy.d.ts +9 -0
- package/dist/src/commands/deploy.d.ts.map +1 -0
- package/dist/src/constants/flags.d.ts +84 -0
- package/dist/src/constants/flags.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/prompts/arns.d.ts +13 -0
- package/dist/src/prompts/arns.d.ts.map +1 -0
- package/dist/src/prompts/deployment.d.ts +6 -0
- package/dist/src/prompts/deployment.d.ts.map +1 -0
- package/dist/src/prompts/wallet.d.ts +11 -0
- package/dist/src/prompts/wallet.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +31 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/__tests__/constants.test.d.ts +2 -0
- package/dist/src/utils/__tests__/constants.test.d.ts.map +1 -0
- package/dist/src/utils/config-resolver.d.ts +72 -0
- package/dist/src/utils/config-resolver.d.ts.map +1 -0
- package/dist/src/utils/constants.d.ts +4 -0
- package/dist/src/utils/constants.d.ts.map +1 -0
- package/dist/src/utils/path.d.ts +5 -0
- package/dist/src/utils/path.d.ts.map +1 -0
- package/dist/src/utils/signer.d.ts +17 -0
- package/dist/src/utils/signer.d.ts.map +1 -0
- package/dist/src/utils/uploader.d.ts +8 -0
- package/dist/src/utils/uploader.d.ts.map +1 -0
- package/dist/src/utils/validators.d.ts +29 -0
- package/dist/src/utils/validators.d.ts.map +1 -0
- package/dist/tests/constants.d.ts +11 -0
- package/dist/tests/constants.d.ts.map +1 -0
- package/dist/tests/e2e/deploy-command.test.d.ts +2 -0
- package/dist/tests/e2e/deploy-command.test.d.ts.map +1 -0
- package/dist/tests/global-setup.d.ts +6 -0
- package/dist/tests/global-setup.d.ts.map +1 -0
- package/dist/tests/mocks/turbo-handlers.d.ts +105 -0
- package/dist/tests/mocks/turbo-handlers.d.ts.map +1 -0
- package/dist/tests/setup.d.ts +11 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/types/payment-service.d.ts +218 -0
- package/dist/tests/types/payment-service.d.ts.map +1 -0
- package/dist/tests/types/upload-service.d.ts +168 -0
- package/dist/tests/types/upload-service.d.ts.map +1 -0
- package/dist/tests/unit/validators.test.d.ts +2 -0
- package/dist/tests/unit/validators.test.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/config-resolver.js +39 -0
- package/dist/utils/config-resolver.js.map +1 -0
- package/dist/utils/constants.js +6 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/path.js +15 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/signer.js +40 -0
- package/dist/utils/signer.js.map +1 -0
- package/dist/utils/uploader.js +78 -0
- package/dist/utils/uploader.js.map +1 -0
- package/dist/utils/validators.js +62 -0
- package/dist/utils/validators.js.map +1 -0
- package/package.json +107 -37
- package/.babelrc +0 -3
- package/.editorconfig +0 -4
- package/.eslintrc.js +0 -35
- package/dist/turbo/index.js +0 -234
- package/src/index.js +0 -287
package/dist/index.js
CHANGED
|
@@ -1,299 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
-
var _turboSdk = require("@ardrive/turbo-sdk");
|
|
6
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
7
|
-
var _yargs = _interopRequireDefault(require("yargs"));
|
|
8
|
-
var _helpers = require("yargs/helpers");
|
|
9
|
-
var _mimeTypes = _interopRequireDefault(require("mime-types"));
|
|
10
|
-
var _sdk = require("@ar.io/sdk");
|
|
11
|
-
var _aoconnect = require("@permaweb/aoconnect");
|
|
12
|
-
var _nodeStream = require("node:stream");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
15
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
16
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
17
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
19
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
20
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
24
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
26
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
28
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
29
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
30
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
31
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
32
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
33
|
-
var arweaveTxIdRegex = /^[a-zA-Z0-9-_]{43}$/;
|
|
34
|
-
var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).version('2.1.0').help().usage('Usage: $0 --arns-name <name> [options]').example('$0 --arns-name my-app', 'Deploy to my-app.arweave.dev').example('$0 --arns-name my-app --undername staging', 'Deploy to staging.my-app.arweave.dev').option('ario-process', {
|
|
35
|
-
alias: 'p',
|
|
36
|
-
type: 'string',
|
|
37
|
-
description: 'The ARIO process to use',
|
|
38
|
-
demandOption: true,
|
|
39
|
-
"default": _sdk.ARIO_MAINNET_PROCESS_ID
|
|
40
|
-
}).option('arns-name', {
|
|
41
|
-
alias: 'n',
|
|
42
|
-
type: 'string',
|
|
43
|
-
description: 'The ARNS name',
|
|
44
|
-
demandOption: true
|
|
45
|
-
}).option('deploy-folder', {
|
|
46
|
-
alias: 'd',
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: 'Folder to deploy.',
|
|
49
|
-
"default": './dist'
|
|
50
|
-
}).option('deploy-file', {
|
|
51
|
-
alias: 'f',
|
|
52
|
-
type: 'string',
|
|
53
|
-
description: 'File to deploy.'
|
|
54
|
-
}).option('ttl-seconds', {
|
|
55
|
-
alias: 't',
|
|
56
|
-
type: 'number',
|
|
57
|
-
description: 'ArNS TTL Seconds',
|
|
58
|
-
"default": 3600
|
|
59
|
-
}).option('undername', {
|
|
60
|
-
alias: 'u',
|
|
61
|
-
type: 'string',
|
|
62
|
-
description: 'ANT undername to update.',
|
|
63
|
-
"default": '@'
|
|
64
|
-
}).option('sig-type', {
|
|
65
|
-
alias: 's',
|
|
66
|
-
type: 'string',
|
|
67
|
-
description: 'The type of signer to be used for deployment.',
|
|
68
|
-
choices: ['arweave', 'ethereum', 'polygon',
|
|
69
|
-
// 'solana',
|
|
70
|
-
'kyve'],
|
|
71
|
-
"default": 'arweave'
|
|
72
|
-
}).check(function (argv) {
|
|
73
|
-
if (argv.ttl < 60 || argv.ttl > 86400) {
|
|
74
|
-
throw new Error('TTL must be between 60 seconds (1 minute) and 86400 seconds (1 day)');
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
}).argv;
|
|
78
|
-
var DEPLOY_KEY = process.env.DEPLOY_KEY;
|
|
79
|
-
var ARNS_NAME = argv['arns-name'];
|
|
80
|
-
var ARIO_PROCESS = argv['ario-process'];
|
|
81
|
-
var TTL_SECONDS = argv['ttl-seconds'];
|
|
82
|
-
if (ARIO_PROCESS === 'mainnet') {
|
|
83
|
-
ARIO_PROCESS = _sdk.ARIO_MAINNET_PROCESS_ID;
|
|
84
|
-
} else if (ARIO_PROCESS === 'testnet') {
|
|
85
|
-
ARIO_PROCESS = _sdk.ARIO_TESTNET_PROCESS_ID;
|
|
86
|
-
}
|
|
87
|
-
_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
88
|
-
var ario, arnsNameRecord, signer, token, jwk, turbo, uploadResult, txOrManifestId, mimeType, origPaths, newPaths, replaceManifest, _i, _Object$entries, _Object$entries$_i, key, value, newKey, newManifest, buffer, _yield$turbo$uploadFi, id, ant, _t, _t2;
|
|
89
|
-
return _regenerator().w(function (_context) {
|
|
90
|
-
while (1) switch (_context.n) {
|
|
91
|
-
case 0:
|
|
92
|
-
if (!ARIO_PROCESS || !arweaveTxIdRegex.test(ARIO_PROCESS)) {
|
|
93
|
-
console.error('ARIO_PROCESS must be a valid Arweave transaction ID, or "mainnet" or "testnet"');
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
96
|
-
if (!DEPLOY_KEY) {
|
|
97
|
-
console.error('DEPLOY_KEY not configured');
|
|
98
|
-
process.exit(1);
|
|
99
|
-
}
|
|
100
|
-
if (!ARNS_NAME) {
|
|
101
|
-
console.error('ARNS_NAME not configured');
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
if (!Number.isFinite(TTL_SECONDS) || TTL_SECONDS < 60 || TTL_SECONDS > 86400) {
|
|
105
|
-
console.error('TTL_SECONDS must be a number between 60 and 86400 seconds');
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
if (argv.deployFile && !_fs["default"].existsSync(argv.deployFile)) {
|
|
109
|
-
console.error("deploy-file [".concat(argv.deployFolder, "] does not exist"));
|
|
110
|
-
process.exit(1);
|
|
111
|
-
} else {
|
|
112
|
-
if (!_fs["default"].existsSync(argv.deployFolder)) {
|
|
113
|
-
console.error("deploy-folder [".concat(argv.deployFolder, "] does not exist"));
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (argv.undername.length === 0) {
|
|
118
|
-
console.error('undername must be set');
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
ario = _sdk.ARIO.init({
|
|
122
|
-
process: new _sdk.AOProcess({
|
|
123
|
-
processId: ARIO_PROCESS,
|
|
124
|
-
ao: (0, _aoconnect.connect)({
|
|
125
|
-
MODE: 'legacy',
|
|
126
|
-
CU_URL: 'https://cu.ardrive.io'
|
|
127
|
-
})
|
|
128
|
-
})
|
|
129
|
-
});
|
|
130
|
-
_context.n = 1;
|
|
131
|
-
return ario.getArNSRecord({
|
|
132
|
-
name: ARNS_NAME
|
|
133
|
-
})["catch"](function (e) {
|
|
134
|
-
console.error("ARNS name [".concat(ARNS_NAME, "] does not exist"));
|
|
135
|
-
process.exit(1);
|
|
136
|
-
});
|
|
137
|
-
case 1:
|
|
138
|
-
arnsNameRecord = _context.v;
|
|
139
|
-
_context.p = 2;
|
|
140
|
-
_t = argv['sig-type'];
|
|
141
|
-
_context.n = _t === 'ethereum' ? 3 : _t === 'polygon' ? 4 : _t === 'arweave' ? 5 : _t === 'kyve' ? 6 : 7;
|
|
142
|
-
break;
|
|
143
|
-
case 3:
|
|
144
|
-
signer = new _turboSdk.EthereumSigner(DEPLOY_KEY);
|
|
145
|
-
token = 'ethereum';
|
|
146
|
-
return _context.a(3, 8);
|
|
147
|
-
case 4:
|
|
148
|
-
signer = new _turboSdk.EthereumSigner(DEPLOY_KEY);
|
|
149
|
-
token = 'pol';
|
|
150
|
-
return _context.a(3, 8);
|
|
151
|
-
case 5:
|
|
152
|
-
jwk = JSON.parse(Buffer.from(DEPLOY_KEY, 'base64').toString('utf-8'));
|
|
153
|
-
signer = new _sdk.ArweaveSigner(jwk);
|
|
154
|
-
token = 'arweave';
|
|
155
|
-
return _context.a(3, 8);
|
|
156
|
-
case 6:
|
|
157
|
-
signer = new _turboSdk.EthereumSigner(DEPLOY_KEY);
|
|
158
|
-
token = 'kyve';
|
|
159
|
-
return _context.a(3, 8);
|
|
160
|
-
case 7:
|
|
161
|
-
throw new Error("Invalid sig-type provided: ".concat(argv['sig-type'], ". Allowed values are 'arweave', 'ethereum', 'polygon', or 'kyve'."));
|
|
162
|
-
case 8:
|
|
163
|
-
turbo = _turboSdk.TurboFactory.authenticated({
|
|
164
|
-
signer: signer,
|
|
165
|
-
token: token
|
|
166
|
-
});
|
|
167
|
-
if (!argv['deploy-file']) {
|
|
168
|
-
_context.n = 10;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
// Detect MIME type for the file
|
|
172
|
-
mimeType = _mimeTypes["default"].lookup(argv['deploy-file']) || 'application/octet-stream';
|
|
173
|
-
_context.n = 9;
|
|
174
|
-
return turbo.uploadFile({
|
|
175
|
-
file: argv['deploy-file'],
|
|
176
|
-
dataItemOpts: {
|
|
177
|
-
tags: [{
|
|
178
|
-
name: 'App-Name',
|
|
179
|
-
value: 'Permaweb-Deploy'
|
|
180
|
-
},
|
|
181
|
-
// prevents identical transaction Ids from eth wallets
|
|
182
|
-
{
|
|
183
|
-
name: 'anchor',
|
|
184
|
-
value: new Date().toISOString()
|
|
185
|
-
}, {
|
|
186
|
-
name: 'Content-Type',
|
|
187
|
-
value: mimeType
|
|
188
|
-
}]
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
case 9:
|
|
192
|
-
uploadResult = _context.v;
|
|
193
|
-
txOrManifestId = uploadResult.id;
|
|
194
|
-
_context.n = 13;
|
|
195
|
-
break;
|
|
196
|
-
case 10:
|
|
197
|
-
_context.n = 11;
|
|
198
|
-
return turbo.uploadFolder({
|
|
199
|
-
folderPath: argv['deploy-folder'],
|
|
200
|
-
dataItemOpts: {
|
|
201
|
-
tags: [{
|
|
202
|
-
name: 'App-Name',
|
|
203
|
-
value: 'Permaweb-Deploy'
|
|
204
|
-
},
|
|
205
|
-
// prevents identical transaction Ids from eth wallets
|
|
206
|
-
{
|
|
207
|
-
name: 'anchor',
|
|
208
|
-
value: new Date().toISOString()
|
|
209
|
-
}]
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
case 11:
|
|
213
|
-
uploadResult = _context.v;
|
|
214
|
-
txOrManifestId = uploadResult.manifestResponse.id; //might replace now
|
|
215
|
-
|
|
216
|
-
// Make default folder paths work by adding extra path entries
|
|
217
|
-
origPaths = uploadResult.manifest.paths;
|
|
218
|
-
newPaths = {};
|
|
219
|
-
replaceManifest = false;
|
|
220
|
-
for (_i = 0, _Object$entries = Object.entries(origPaths); _i < _Object$entries.length; _i++) {
|
|
221
|
-
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
|
|
222
|
-
newPaths[key] = value;
|
|
223
|
-
if (key.endsWith('/index.html')) {
|
|
224
|
-
newKey = key.replace(/\/index\.html$/, '');
|
|
225
|
-
newPaths[newKey] = value;
|
|
226
|
-
replaceManifest = true;
|
|
227
|
-
}
|
|
228
|
-
;
|
|
229
|
-
}
|
|
230
|
-
;
|
|
231
|
-
if (!replaceManifest) {
|
|
232
|
-
_context.n = 13;
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
console.info('replacing manifest');
|
|
236
|
-
newManifest = _objectSpread(_objectSpread({}, uploadResult.manifest), {}, {
|
|
237
|
-
paths: newPaths
|
|
238
|
-
});
|
|
239
|
-
buffer = Buffer.from(JSON.stringify(newManifest));
|
|
240
|
-
_context.n = 12;
|
|
241
|
-
return turbo.uploadFile({
|
|
242
|
-
fileStreamFactory: function fileStreamFactory() {
|
|
243
|
-
return _nodeStream.Readable.from(buffer);
|
|
244
|
-
},
|
|
245
|
-
fileSizeFactory: function fileSizeFactory() {
|
|
246
|
-
return buffer.length;
|
|
247
|
-
},
|
|
248
|
-
dataItemOpts: {
|
|
249
|
-
tags: [{
|
|
250
|
-
name: 'Content-Type',
|
|
251
|
-
value: 'application/x.arweave-manifest+json'
|
|
252
|
-
}]
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
case 12:
|
|
256
|
-
_yield$turbo$uploadFi = _context.v;
|
|
257
|
-
id = _yield$turbo$uploadFi.id;
|
|
258
|
-
txOrManifestId = id;
|
|
259
|
-
case 13:
|
|
260
|
-
console.log('-------------------- DEPLOY DETAILS --------------------');
|
|
261
|
-
console.log("Tx ID: ".concat(txOrManifestId));
|
|
262
|
-
console.log("ArNS Name: ".concat(ARNS_NAME));
|
|
263
|
-
console.log("Undername: ".concat(argv.undername));
|
|
264
|
-
console.log("ANT: ".concat(arnsNameRecord.processId));
|
|
265
|
-
console.log("AR IO Process: ".concat(ARIO_PROCESS));
|
|
266
|
-
console.log("TTL Seconds: ".concat(TTL_SECONDS));
|
|
267
|
-
console.log('--------------------------------------------------------');
|
|
268
|
-
ant = _sdk.ANT.init({
|
|
269
|
-
processId: arnsNameRecord.processId,
|
|
270
|
-
signer: signer
|
|
271
|
-
}); // Update the ANT record (assumes the JWK is a controller or owner)
|
|
272
|
-
_context.n = 14;
|
|
273
|
-
return ant.setRecord({
|
|
274
|
-
undername: argv.undername,
|
|
275
|
-
transactionId: txOrManifestId,
|
|
276
|
-
ttlSeconds: argv['ttl-seconds']
|
|
277
|
-
}, {
|
|
278
|
-
tags: [{
|
|
279
|
-
name: 'App-Name',
|
|
280
|
-
value: 'Permaweb-Deploy'
|
|
281
|
-
}].concat(_toConsumableArray(process.env.GITHUB_SHA ? [{
|
|
282
|
-
name: 'GIT-HASH',
|
|
283
|
-
value: process.env.GITHUB_SHA
|
|
284
|
-
}] : []))
|
|
285
|
-
});
|
|
286
|
-
case 14:
|
|
287
|
-
console.log("Deployed TxId [".concat(txOrManifestId, "] to name [").concat(ARNS_NAME, "] for ANT [").concat(arnsNameRecord.processId, "] using undername [").concat(argv.undername, "]"));
|
|
288
|
-
_context.n = 16;
|
|
289
|
-
break;
|
|
290
|
-
case 15:
|
|
291
|
-
_context.p = 15;
|
|
292
|
-
_t2 = _context.v;
|
|
293
|
-
console.error('Deployment failed:', _t2);
|
|
294
|
-
process.exit(1); // Exit with error code
|
|
295
|
-
case 16:
|
|
296
|
-
return _context.a(2);
|
|
297
|
-
}
|
|
298
|
-
}, _callee, null, [[2, 15]]);
|
|
299
|
-
}))();
|
|
1
|
+
export { run } from '@oclif/core';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID } from '@ar.io/sdk';
|
|
2
|
+
import { input, select, confirm } from '@inquirer/prompts';
|
|
3
|
+
import { validateArnsName, validateArioProcess, validateTtl } from '../utils/validators.js';
|
|
4
|
+
|
|
5
|
+
async function promptArnsName() {
|
|
6
|
+
return input({
|
|
7
|
+
message: "Enter your ArNS name:",
|
|
8
|
+
required: true,
|
|
9
|
+
validate: validateArnsName
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async function promptUndername() {
|
|
13
|
+
return input({
|
|
14
|
+
default: "@",
|
|
15
|
+
message: "Enter undername (subdomain):"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async function promptTtl() {
|
|
19
|
+
return input({
|
|
20
|
+
default: "60",
|
|
21
|
+
message: "Enter TTL in seconds:",
|
|
22
|
+
validate: validateTtl
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function promptArioProcess() {
|
|
26
|
+
const networkChoice = await select({
|
|
27
|
+
choices: [
|
|
28
|
+
{ name: "Mainnet", value: "mainnet" },
|
|
29
|
+
{ name: "Testnet", value: "testnet" },
|
|
30
|
+
{ name: "Custom Process ID", value: "custom" }
|
|
31
|
+
],
|
|
32
|
+
default: "mainnet",
|
|
33
|
+
message: "Select ARIO network:"
|
|
34
|
+
});
|
|
35
|
+
if (networkChoice === "custom") {
|
|
36
|
+
return input({
|
|
37
|
+
message: "Enter ARIO process ID:",
|
|
38
|
+
validate: validateArioProcess
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return networkChoice === "mainnet" ? ARIO_MAINNET_PROCESS_ID : ARIO_TESTNET_PROCESS_ID;
|
|
42
|
+
}
|
|
43
|
+
async function promptAdvancedOptions() {
|
|
44
|
+
const wantsAdvanced = await confirm({
|
|
45
|
+
default: false,
|
|
46
|
+
message: "Configure advanced options?"
|
|
47
|
+
});
|
|
48
|
+
if (!wantsAdvanced) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const undername = await promptUndername();
|
|
52
|
+
const ttlSeconds = await promptTtl();
|
|
53
|
+
const arioProcess = await promptArioProcess();
|
|
54
|
+
const wantsOnDemand = await confirm({
|
|
55
|
+
default: false,
|
|
56
|
+
message: "Enable on-demand payment?"
|
|
57
|
+
});
|
|
58
|
+
let onDemand;
|
|
59
|
+
let maxTokenAmount;
|
|
60
|
+
if (wantsOnDemand) {
|
|
61
|
+
onDemand = await select({
|
|
62
|
+
choices: [
|
|
63
|
+
{ name: "ARIO", value: "ario" },
|
|
64
|
+
{ name: "ETH (Base Network)", value: "base-eth" }
|
|
65
|
+
],
|
|
66
|
+
message: "Select payment token:"
|
|
67
|
+
});
|
|
68
|
+
maxTokenAmount = await input({
|
|
69
|
+
message: "Enter maximum token amount:",
|
|
70
|
+
validate(value) {
|
|
71
|
+
const num = Number.parseFloat(value);
|
|
72
|
+
if (Number.isNaN(num) || num <= 0) {
|
|
73
|
+
return "Please enter a valid positive number";
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
arioProcess,
|
|
81
|
+
maxTokenAmount,
|
|
82
|
+
onDemand,
|
|
83
|
+
ttlSeconds,
|
|
84
|
+
undername
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { promptAdvancedOptions, promptArioProcess, promptArnsName, promptTtl, promptUndername };
|
|
89
|
+
//# sourceMappingURL=arns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arns.js","sources":["../../src/prompts/arns.ts"],"sourcesContent":["import { ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID } from '@ar.io/sdk'\nimport { confirm, input, select } from '@inquirer/prompts'\n\nimport { validateArioProcess, validateArnsName, validateTtl } from '../utils/validators.js'\n\nexport interface AdvancedOptions {\n arioProcess: string\n maxTokenAmount?: string\n onDemand?: string\n ttlSeconds: string\n undername: string\n}\n\nexport async function promptArnsName(): Promise<string> {\n return input({\n message: 'Enter your ArNS name:',\n required: true,\n validate: validateArnsName,\n })\n}\n\nexport async function promptUndername(): Promise<string> {\n return input({\n default: '@',\n message: 'Enter undername (subdomain):',\n })\n}\n\nexport async function promptTtl(): Promise<string> {\n return input({\n default: '60',\n message: 'Enter TTL in seconds:',\n validate: validateTtl,\n })\n}\n\nexport async function promptArioProcess(): Promise<string> {\n const networkChoice = await select({\n choices: [\n { name: 'Mainnet', value: 'mainnet' },\n { name: 'Testnet', value: 'testnet' },\n { name: 'Custom Process ID', value: 'custom' },\n ],\n default: 'mainnet',\n message: 'Select ARIO network:',\n })\n\n if (networkChoice === 'custom') {\n return input({\n message: 'Enter ARIO process ID:',\n validate: validateArioProcess,\n })\n }\n\n return networkChoice === 'mainnet' ? ARIO_MAINNET_PROCESS_ID : ARIO_TESTNET_PROCESS_ID\n}\n\nexport async function promptAdvancedOptions(): Promise<AdvancedOptions | null> {\n const wantsAdvanced = await confirm({\n default: false,\n message: 'Configure advanced options?',\n })\n\n if (!wantsAdvanced) {\n return null\n }\n\n const undername = await promptUndername()\n const ttlSeconds = await promptTtl()\n const arioProcess = await promptArioProcess()\n\n // On-demand payment options\n const wantsOnDemand = await confirm({\n default: false,\n message: 'Enable on-demand payment?',\n })\n\n let onDemand: string | undefined\n let maxTokenAmount: string | undefined\n\n if (wantsOnDemand) {\n onDemand = await select({\n choices: [\n { name: 'ARIO', value: 'ario' },\n { name: 'ETH (Base Network)', value: 'base-eth' },\n ],\n message: 'Select payment token:',\n })\n\n maxTokenAmount = await input({\n message: 'Enter maximum token amount:',\n validate(value: string) {\n const num = Number.parseFloat(value)\n if (Number.isNaN(num) || num <= 0) {\n return 'Please enter a valid positive number'\n }\n\n return true\n },\n })\n }\n\n return {\n arioProcess,\n maxTokenAmount,\n onDemand,\n ttlSeconds,\n undername,\n }\n}\n"],"names":[],"mappings":";;;;AAaA,eAAsB,cAAA,GAAkC;AACtD,EAAA,OAAO,KAAA,CAAM;AAAA,IACX,OAAA,EAAS,uBAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,QAAA,EAAU;AAAA,GACX,CAAA;AACH;AAEA,eAAsB,eAAA,GAAmC;AACvD,EAAA,OAAO,KAAA,CAAM;AAAA,IACX,OAAA,EAAS,GAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACV,CAAA;AACH;AAEA,eAAsB,SAAA,GAA6B;AACjD,EAAA,OAAO,KAAA,CAAM;AAAA,IACX,OAAA,EAAS,IAAA;AAAA,IACT,OAAA,EAAS,uBAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACX,CAAA;AACH;AAEA,eAAsB,iBAAA,GAAqC;AACzD,EAAA,MAAM,aAAA,GAAgB,MAAM,MAAA,CAAO;AAAA,IACjC,OAAA,EAAS;AAAA,MACP,EAAE,IAAA,EAAM,SAAA,EAAW,KAAA,EAAO,SAAA,EAAU;AAAA,MACpC,EAAE,IAAA,EAAM,SAAA,EAAW,KAAA,EAAO,SAAA,EAAU;AAAA,MACpC,EAAE,IAAA,EAAM,mBAAA,EAAqB,KAAA,EAAO,QAAA;AAAS,KAC/C;AAAA,IACA,OAAA,EAAS,SAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,IAAI,kBAAkB,QAAA,EAAU;AAC9B,IAAA,OAAO,KAAA,CAAM;AAAA,MACX,OAAA,EAAS,wBAAA;AAAA,MACT,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,aAAA,KAAkB,YAAY,uBAAA,GAA0B,uBAAA;AACjE;AAEA,eAAsB,qBAAA,GAAyD;AAC7E,EAAA,MAAM,aAAA,GAAgB,MAAM,OAAA,CAAQ;AAAA,IAClC,OAAA,EAAS,KAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY,MAAM,eAAA,EAAgB;AACxC,EAAA,MAAM,UAAA,GAAa,MAAM,SAAA,EAAU;AACnC,EAAA,MAAM,WAAA,GAAc,MAAM,iBAAA,EAAkB;AAG5C,EAAA,MAAM,aAAA,GAAgB,MAAM,OAAA,CAAQ;AAAA,IAClC,OAAA,EAAS,KAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI,cAAA;AAEJ,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,QAAA,GAAW,MAAM,MAAA,CAAO;AAAA,MACtB,OAAA,EAAS;AAAA,QACP,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAO;AAAA,QAC9B,EAAE,IAAA,EAAM,oBAAA,EAAsB,KAAA,EAAO,UAAA;AAAW,OAClD;AAAA,MACA,OAAA,EAAS;AAAA,KACV,CAAA;AAED,IAAA,cAAA,GAAiB,MAAM,KAAA,CAAM;AAAA,MAC3B,OAAA,EAAS,6BAAA;AAAA,MACT,SAAS,KAAA,EAAe;AACtB,QAAA,MAAM,GAAA,GAAM,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AACnC,QAAA,IAAI,MAAA,CAAO,KAAA,CAAM,GAAG,CAAA,IAAK,OAAO,CAAA,EAAG;AACjC,UAAA,OAAO,sCAAA;AAAA,QACT;AAEA,QAAA,OAAO,IAAA;AAAA,MACT;AAAA,KACD,CAAA;AAAA,EACH;AAEA,EAAA,OAAO;AAAA,IACL,WAAA;AAAA,IACA,cAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { select, input } from '@inquirer/prompts';
|
|
2
|
+
import { validateFolderExists, validateFileExists } from '../utils/validators.js';
|
|
3
|
+
|
|
4
|
+
async function promptDeployTarget() {
|
|
5
|
+
const deployType = await select({
|
|
6
|
+
choices: [
|
|
7
|
+
{ name: "Deploy a folder", value: "folder" },
|
|
8
|
+
{ name: "Deploy a single file", value: "file" }
|
|
9
|
+
],
|
|
10
|
+
message: "What do you want to deploy?"
|
|
11
|
+
});
|
|
12
|
+
const deployPath = await (deployType === "folder" ? input({
|
|
13
|
+
default: "./dist",
|
|
14
|
+
message: "Enter folder path to deploy:",
|
|
15
|
+
validate: validateFolderExists
|
|
16
|
+
}) : input({
|
|
17
|
+
message: "Enter file path to deploy:",
|
|
18
|
+
validate: validateFileExists
|
|
19
|
+
}));
|
|
20
|
+
return {
|
|
21
|
+
path: deployPath,
|
|
22
|
+
type: deployType
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { promptDeployTarget };
|
|
27
|
+
//# sourceMappingURL=deployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.js","sources":["../../src/prompts/deployment.ts"],"sourcesContent":["import { input, select } from '@inquirer/prompts'\n\nimport { validateFileExists, validateFolderExists } from '../utils/validators.js'\n\nexport interface DeployTarget {\n path: string\n type: 'file' | 'folder'\n}\n\nexport async function promptDeployTarget(): Promise<DeployTarget> {\n const deployType = (await select({\n choices: [\n { name: 'Deploy a folder', value: 'folder' },\n { name: 'Deploy a single file', value: 'file' },\n ],\n message: 'What do you want to deploy?',\n })) as 'file' | 'folder'\n\n const deployPath = await (deployType === 'folder'\n ? input({\n default: './dist',\n message: 'Enter folder path to deploy:',\n validate: validateFolderExists,\n })\n : input({\n message: 'Enter file path to deploy:',\n validate: validateFileExists,\n }))\n\n return {\n path: deployPath,\n type: deployType,\n }\n}\n"],"names":[],"mappings":";;;AASA,eAAsB,kBAAA,GAA4C;AAChE,EAAA,MAAM,UAAA,GAAc,MAAM,MAAA,CAAO;AAAA,IAC/B,OAAA,EAAS;AAAA,MACP,EAAE,IAAA,EAAM,iBAAA,EAAmB,KAAA,EAAO,QAAA,EAAS;AAAA,MAC3C,EAAE,IAAA,EAAM,sBAAA,EAAwB,KAAA,EAAO,MAAA;AAAO,KAChD;AAAA,IACA,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,MAAM,UAAA,GAAa,OAAO,UAAA,KAAe,QAAA,GACrC,KAAA,CAAM;AAAA,IACJ,OAAA,EAAS,QAAA;AAAA,IACT,OAAA,EAAS,8BAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACX,IACD,KAAA,CAAM;AAAA,IACJ,OAAA,EAAS,4BAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACX,CAAA,CAAA;AAEL,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AACF;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { select, input } from '@inquirer/prompts';
|
|
2
|
+
import { validateFileExists } from '../utils/validators.js';
|
|
3
|
+
|
|
4
|
+
async function promptWalletMethod() {
|
|
5
|
+
return select({
|
|
6
|
+
choices: [
|
|
7
|
+
{ name: "Wallet file path", value: "file" },
|
|
8
|
+
{ name: "Private key/JWK string", value: "string" },
|
|
9
|
+
{ name: "Environment variable (DEPLOY_KEY)", value: "env" }
|
|
10
|
+
],
|
|
11
|
+
message: "How do you want to provide your wallet?"
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async function promptWalletFile() {
|
|
15
|
+
return input({
|
|
16
|
+
default: "./wallet.json",
|
|
17
|
+
message: "Enter wallet file path:",
|
|
18
|
+
validate: validateFileExists
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async function promptPrivateKey() {
|
|
22
|
+
return input({
|
|
23
|
+
message: "Enter your private key or JWK JSON:",
|
|
24
|
+
required: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function promptSignerType() {
|
|
28
|
+
return select({
|
|
29
|
+
choices: [
|
|
30
|
+
{ name: "Arweave", value: "arweave" },
|
|
31
|
+
{ name: "Ethereum", value: "ethereum" },
|
|
32
|
+
{ name: "Polygon", value: "polygon" },
|
|
33
|
+
{ name: "KYVE", value: "kyve" }
|
|
34
|
+
],
|
|
35
|
+
default: "arweave",
|
|
36
|
+
message: "Select signer type:"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function getWalletConfig() {
|
|
40
|
+
const method = await promptWalletMethod();
|
|
41
|
+
const config = { method };
|
|
42
|
+
if (method === "file") {
|
|
43
|
+
config.wallet = await promptWalletFile();
|
|
44
|
+
} else if (method === "string") {
|
|
45
|
+
config.privateKey = await promptPrivateKey();
|
|
46
|
+
}
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { getWalletConfig, promptPrivateKey, promptSignerType, promptWalletFile, promptWalletMethod };
|
|
51
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.js","sources":["../../src/prompts/wallet.ts"],"sourcesContent":["import { input, select } from '@inquirer/prompts'\n\nimport { validateFileExists } from '../utils/validators.js'\n\nexport interface WalletConfig {\n method: 'env' | 'file' | 'string'\n privateKey?: string\n wallet?: string\n}\n\nexport async function promptWalletMethod(): Promise<string> {\n return select({\n choices: [\n { name: 'Wallet file path', value: 'file' },\n { name: 'Private key/JWK string', value: 'string' },\n { name: 'Environment variable (DEPLOY_KEY)', value: 'env' },\n ],\n message: 'How do you want to provide your wallet?',\n })\n}\n\nexport async function promptWalletFile(): Promise<string> {\n return input({\n default: './wallet.json',\n message: 'Enter wallet file path:',\n validate: validateFileExists,\n })\n}\n\nexport async function promptPrivateKey(): Promise<string> {\n return input({\n message: 'Enter your private key or JWK JSON:',\n required: true,\n })\n}\n\nexport async function promptSignerType(): Promise<string> {\n return select({\n choices: [\n { name: 'Arweave', value: 'arweave' },\n { name: 'Ethereum', value: 'ethereum' },\n { name: 'Polygon', value: 'polygon' },\n { name: 'KYVE', value: 'kyve' },\n ],\n default: 'arweave',\n message: 'Select signer type:',\n })\n}\n\nexport async function getWalletConfig(): Promise<WalletConfig> {\n const method = (await promptWalletMethod()) as 'env' | 'file' | 'string'\n\n const config: WalletConfig = { method }\n\n if (method === 'file') {\n config.wallet = await promptWalletFile()\n } else if (method === 'string') {\n config.privateKey = await promptPrivateKey()\n }\n\n return config\n}\n"],"names":[],"mappings":";;;AAUA,eAAsB,kBAAA,GAAsC;AAC1D,EAAA,OAAO,MAAA,CAAO;AAAA,IACZ,OAAA,EAAS;AAAA,MACP,EAAE,IAAA,EAAM,kBAAA,EAAoB,KAAA,EAAO,MAAA,EAAO;AAAA,MAC1C,EAAE,IAAA,EAAM,wBAAA,EAA0B,KAAA,EAAO,QAAA,EAAS;AAAA,MAClD,EAAE,IAAA,EAAM,mCAAA,EAAqC,KAAA,EAAO,KAAA;AAAM,KAC5D;AAAA,IACA,OAAA,EAAS;AAAA,GACV,CAAA;AACH;AAEA,eAAsB,gBAAA,GAAoC;AACxD,EAAA,OAAO,KAAA,CAAM;AAAA,IACX,OAAA,EAAS,eAAA;AAAA,IACT,OAAA,EAAS,yBAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACX,CAAA;AACH;AAEA,eAAsB,gBAAA,GAAoC;AACxD,EAAA,OAAO,KAAA,CAAM;AAAA,IACX,OAAA,EAAS,qCAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACX,CAAA;AACH;AAEA,eAAsB,gBAAA,GAAoC;AACxD,EAAA,OAAO,MAAA,CAAO;AAAA,IACZ,OAAA,EAAS;AAAA,MACP,EAAE,IAAA,EAAM,SAAA,EAAW,KAAA,EAAO,SAAA,EAAU;AAAA,MACpC,EAAE,IAAA,EAAM,UAAA,EAAY,KAAA,EAAO,UAAA,EAAW;AAAA,MACtC,EAAE,IAAA,EAAM,SAAA,EAAW,KAAA,EAAO,SAAA,EAAU;AAAA,MACpC,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAA,EAAO,MAAA;AAAO,KAChC;AAAA,IACA,OAAA,EAAS,SAAA;AAAA,IACT,OAAA,EAAS;AAAA,GACV,CAAA;AACH;AAEA,eAAsB,eAAA,GAAyC;AAC7D,EAAA,MAAM,MAAA,GAAU,MAAM,kBAAA,EAAmB;AAEzC,EAAA,MAAM,MAAA,GAAuB,EAAE,MAAA,EAAO;AAEtC,EAAA,IAAI,WAAW,MAAA,EAAQ;AACrB,IAAA,MAAA,CAAO,MAAA,GAAS,MAAM,gBAAA,EAAiB;AAAA,EACzC,CAAA,MAAA,IAAW,WAAW,QAAA,EAAU;AAC9B,IAAA,MAAA,CAAO,UAAA,GAAa,MAAM,gBAAA,EAAiB;AAAA,EAC7C;AAEA,EAAA,OAAO,MAAA;AACT;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Deploy extends Command {
|
|
3
|
+
static args: {};
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: Record<string, any>;
|
|
7
|
+
run(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAgBrC,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,OAAgB,IAAI,KAAK;IAEzB,OAAgB,WAAW,SAA4C;IAEvE,OAAgB,QAAQ,WASvB;IAED,OAAgB,KAAK,sBAAkC;IAE1C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoQlC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global flag definitions - single source of truth for all flags
|
|
3
|
+
* Each flag includes its oclif definition and optional prompt function
|
|
4
|
+
*/
|
|
5
|
+
export declare const globalFlags: {
|
|
6
|
+
arioProcess: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
7
|
+
arnsName: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
8
|
+
deployFile: import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
9
|
+
deployFolder: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
10
|
+
maxTokenAmount: import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
11
|
+
onDemand: import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
12
|
+
privateKey: import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
13
|
+
sigType: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
14
|
+
ttlSeconds: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
15
|
+
undername: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
16
|
+
wallet: import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Complete set of flags for the deploy command
|
|
20
|
+
*/
|
|
21
|
+
export declare const deployFlags: {
|
|
22
|
+
'ario-process': any;
|
|
23
|
+
'arns-name': any;
|
|
24
|
+
'deploy-file': any;
|
|
25
|
+
'deploy-folder': any;
|
|
26
|
+
'max-token-amount': any;
|
|
27
|
+
'on-demand': any;
|
|
28
|
+
'private-key': any;
|
|
29
|
+
'sig-type': any;
|
|
30
|
+
'ttl-seconds': any;
|
|
31
|
+
undername: any;
|
|
32
|
+
wallet: any;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* ArNS-specific flags (subset of deploy flags)
|
|
36
|
+
*/
|
|
37
|
+
export declare const arnsFlags: {
|
|
38
|
+
'ario-process': any;
|
|
39
|
+
'arns-name': any;
|
|
40
|
+
'ttl-seconds': any;
|
|
41
|
+
undername: any;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Wallet/authentication flags (subset of deploy flags)
|
|
45
|
+
*/
|
|
46
|
+
export declare const walletFlags: {
|
|
47
|
+
'private-key': any;
|
|
48
|
+
'sig-type': any;
|
|
49
|
+
wallet: any;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Deploy command configuration type
|
|
53
|
+
*/
|
|
54
|
+
export interface DeployConfig {
|
|
55
|
+
'ario-process': string;
|
|
56
|
+
'arns-name': string;
|
|
57
|
+
'deploy-file'?: string;
|
|
58
|
+
'deploy-folder': string;
|
|
59
|
+
'max-token-amount'?: string;
|
|
60
|
+
'on-demand'?: string;
|
|
61
|
+
'private-key'?: string;
|
|
62
|
+
'sig-type': string;
|
|
63
|
+
'ttl-seconds': string;
|
|
64
|
+
undername: string;
|
|
65
|
+
wallet?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Deploy command flag configurations
|
|
69
|
+
* Maps kebab-case flag names to their camelCase globalFlags definitions
|
|
70
|
+
*/
|
|
71
|
+
export declare const deployFlagConfigs: {
|
|
72
|
+
readonly 'ario-process': import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
73
|
+
readonly 'arns-name': import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
74
|
+
readonly 'deploy-file': import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
75
|
+
readonly 'deploy-folder': import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
76
|
+
readonly 'max-token-amount': import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
77
|
+
readonly 'on-demand': import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
78
|
+
readonly 'private-key': import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
79
|
+
readonly 'sig-type': import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
80
|
+
readonly 'ttl-seconds': import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
81
|
+
readonly undername: import("../utils/config-resolver.js").FlagConfig<string, any>;
|
|
82
|
+
readonly wallet: import("../utils/config-resolver.js").FlagConfig<string | undefined, any>;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/constants/flags.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;CAkJvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;CAYvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAKrB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;CAYpB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AdvancedOptions {
|
|
2
|
+
arioProcess: string;
|
|
3
|
+
maxTokenAmount?: string;
|
|
4
|
+
onDemand?: string;
|
|
5
|
+
ttlSeconds: string;
|
|
6
|
+
undername: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function promptArnsName(): Promise<string>;
|
|
9
|
+
export declare function promptUndername(): Promise<string>;
|
|
10
|
+
export declare function promptTtl(): Promise<string>;
|
|
11
|
+
export declare function promptArioProcess(): Promise<string>;
|
|
12
|
+
export declare function promptAdvancedOptions(): Promise<AdvancedOptions | null>;
|
|
13
|
+
//# sourceMappingURL=arns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arns.d.ts","sourceRoot":"","sources":["../../../src/prompts/arns.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAMtD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAKvD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAMjD;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAmBzD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAoD7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/prompts/deployment.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;CACxB;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CAwBhE"}
|