@donezone/cli 0.1.46 → 0.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +531 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21452,6 +21452,452 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
21452
21452
|
global.eddsa = () => global._eddsa || (global._eddsa = new elliptic_1.eddsa("ed25519"));
|
|
21453
21453
|
});
|
|
21454
21454
|
|
|
21455
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/ascii.js
|
|
21456
|
+
var require_ascii2 = __commonJS((exports) => {
|
|
21457
|
+
function toAscii(input) {
|
|
21458
|
+
const toNums = (str) => str.split("").map((x) => {
|
|
21459
|
+
const charCode = x.charCodeAt(0);
|
|
21460
|
+
if (charCode < 32 || charCode > 126) {
|
|
21461
|
+
throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode);
|
|
21462
|
+
}
|
|
21463
|
+
return charCode;
|
|
21464
|
+
});
|
|
21465
|
+
return Uint8Array.from(toNums(input));
|
|
21466
|
+
}
|
|
21467
|
+
function fromAscii(data) {
|
|
21468
|
+
const fromNums = (listOfNumbers) => listOfNumbers.map((x) => {
|
|
21469
|
+
if (x < 32 || x > 126) {
|
|
21470
|
+
throw new Error("Cannot decode character that is out of printable ASCII range: " + x);
|
|
21471
|
+
}
|
|
21472
|
+
return String.fromCharCode(x);
|
|
21473
|
+
});
|
|
21474
|
+
return fromNums(Array.from(data)).join("");
|
|
21475
|
+
}
|
|
21476
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21477
|
+
exports.fromAscii = exports.toAscii = undefined;
|
|
21478
|
+
exports.toAscii = toAscii;
|
|
21479
|
+
exports.fromAscii = fromAscii;
|
|
21480
|
+
});
|
|
21481
|
+
|
|
21482
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/base64.js
|
|
21483
|
+
var require_base642 = __commonJS((exports) => {
|
|
21484
|
+
function toBase64(data) {
|
|
21485
|
+
return base64js.fromByteArray(data);
|
|
21486
|
+
}
|
|
21487
|
+
function fromBase64(base64String) {
|
|
21488
|
+
if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) {
|
|
21489
|
+
throw new Error("Invalid base64 string format");
|
|
21490
|
+
}
|
|
21491
|
+
return base64js.toByteArray(base64String);
|
|
21492
|
+
}
|
|
21493
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
21494
|
+
if (k2 === undefined)
|
|
21495
|
+
k2 = k;
|
|
21496
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21497
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21498
|
+
desc = { enumerable: true, get: function() {
|
|
21499
|
+
return m[k];
|
|
21500
|
+
} };
|
|
21501
|
+
}
|
|
21502
|
+
Object.defineProperty(o, k2, desc);
|
|
21503
|
+
} : function(o, m, k, k2) {
|
|
21504
|
+
if (k2 === undefined)
|
|
21505
|
+
k2 = k;
|
|
21506
|
+
o[k2] = m[k];
|
|
21507
|
+
});
|
|
21508
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
21509
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21510
|
+
} : function(o, v) {
|
|
21511
|
+
o["default"] = v;
|
|
21512
|
+
});
|
|
21513
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
21514
|
+
if (mod && mod.__esModule)
|
|
21515
|
+
return mod;
|
|
21516
|
+
var result = {};
|
|
21517
|
+
if (mod != null) {
|
|
21518
|
+
for (var k in mod)
|
|
21519
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
21520
|
+
__createBinding(result, mod, k);
|
|
21521
|
+
}
|
|
21522
|
+
__setModuleDefault(result, mod);
|
|
21523
|
+
return result;
|
|
21524
|
+
};
|
|
21525
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21526
|
+
exports.fromBase64 = exports.toBase64 = undefined;
|
|
21527
|
+
var base64js = __importStar(require_base64_js());
|
|
21528
|
+
exports.toBase64 = toBase64;
|
|
21529
|
+
exports.fromBase64 = fromBase64;
|
|
21530
|
+
});
|
|
21531
|
+
|
|
21532
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/node_modules/bech32/index.js
|
|
21533
|
+
var require_bech323 = __commonJS((exports, module) => {
|
|
21534
|
+
function polymodStep(pre) {
|
|
21535
|
+
var b = pre >> 25;
|
|
21536
|
+
return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
|
|
21537
|
+
}
|
|
21538
|
+
function prefixChk(prefix) {
|
|
21539
|
+
var chk = 1;
|
|
21540
|
+
for (var i = 0;i < prefix.length; ++i) {
|
|
21541
|
+
var c = prefix.charCodeAt(i);
|
|
21542
|
+
if (c < 33 || c > 126)
|
|
21543
|
+
return "Invalid prefix (" + prefix + ")";
|
|
21544
|
+
chk = polymodStep(chk) ^ c >> 5;
|
|
21545
|
+
}
|
|
21546
|
+
chk = polymodStep(chk);
|
|
21547
|
+
for (i = 0;i < prefix.length; ++i) {
|
|
21548
|
+
var v = prefix.charCodeAt(i);
|
|
21549
|
+
chk = polymodStep(chk) ^ v & 31;
|
|
21550
|
+
}
|
|
21551
|
+
return chk;
|
|
21552
|
+
}
|
|
21553
|
+
function encode(prefix, words, LIMIT) {
|
|
21554
|
+
LIMIT = LIMIT || 90;
|
|
21555
|
+
if (prefix.length + 7 + words.length > LIMIT)
|
|
21556
|
+
throw new TypeError("Exceeds length limit");
|
|
21557
|
+
prefix = prefix.toLowerCase();
|
|
21558
|
+
var chk = prefixChk(prefix);
|
|
21559
|
+
if (typeof chk === "string")
|
|
21560
|
+
throw new Error(chk);
|
|
21561
|
+
var result = prefix + "1";
|
|
21562
|
+
for (var i = 0;i < words.length; ++i) {
|
|
21563
|
+
var x2 = words[i];
|
|
21564
|
+
if (x2 >> 5 !== 0)
|
|
21565
|
+
throw new Error("Non 5-bit word");
|
|
21566
|
+
chk = polymodStep(chk) ^ x2;
|
|
21567
|
+
result += ALPHABET.charAt(x2);
|
|
21568
|
+
}
|
|
21569
|
+
for (i = 0;i < 6; ++i) {
|
|
21570
|
+
chk = polymodStep(chk);
|
|
21571
|
+
}
|
|
21572
|
+
chk ^= 1;
|
|
21573
|
+
for (i = 0;i < 6; ++i) {
|
|
21574
|
+
var v = chk >> (5 - i) * 5 & 31;
|
|
21575
|
+
result += ALPHABET.charAt(v);
|
|
21576
|
+
}
|
|
21577
|
+
return result;
|
|
21578
|
+
}
|
|
21579
|
+
function __decode(str, LIMIT) {
|
|
21580
|
+
LIMIT = LIMIT || 90;
|
|
21581
|
+
if (str.length < 8)
|
|
21582
|
+
return str + " too short";
|
|
21583
|
+
if (str.length > LIMIT)
|
|
21584
|
+
return "Exceeds length limit";
|
|
21585
|
+
var lowered = str.toLowerCase();
|
|
21586
|
+
var uppered = str.toUpperCase();
|
|
21587
|
+
if (str !== lowered && str !== uppered)
|
|
21588
|
+
return "Mixed-case string " + str;
|
|
21589
|
+
str = lowered;
|
|
21590
|
+
var split = str.lastIndexOf("1");
|
|
21591
|
+
if (split === -1)
|
|
21592
|
+
return "No separator character for " + str;
|
|
21593
|
+
if (split === 0)
|
|
21594
|
+
return "Missing prefix for " + str;
|
|
21595
|
+
var prefix = str.slice(0, split);
|
|
21596
|
+
var wordChars = str.slice(split + 1);
|
|
21597
|
+
if (wordChars.length < 6)
|
|
21598
|
+
return "Data too short";
|
|
21599
|
+
var chk = prefixChk(prefix);
|
|
21600
|
+
if (typeof chk === "string")
|
|
21601
|
+
return chk;
|
|
21602
|
+
var words = [];
|
|
21603
|
+
for (var i = 0;i < wordChars.length; ++i) {
|
|
21604
|
+
var c = wordChars.charAt(i);
|
|
21605
|
+
var v = ALPHABET_MAP[c];
|
|
21606
|
+
if (v === undefined)
|
|
21607
|
+
return "Unknown character " + c;
|
|
21608
|
+
chk = polymodStep(chk) ^ v;
|
|
21609
|
+
if (i + 6 >= wordChars.length)
|
|
21610
|
+
continue;
|
|
21611
|
+
words.push(v);
|
|
21612
|
+
}
|
|
21613
|
+
if (chk !== 1)
|
|
21614
|
+
return "Invalid checksum for " + str;
|
|
21615
|
+
return { prefix, words };
|
|
21616
|
+
}
|
|
21617
|
+
function decodeUnsafe() {
|
|
21618
|
+
var res = __decode.apply(null, arguments);
|
|
21619
|
+
if (typeof res === "object")
|
|
21620
|
+
return res;
|
|
21621
|
+
}
|
|
21622
|
+
function decode(str) {
|
|
21623
|
+
var res = __decode.apply(null, arguments);
|
|
21624
|
+
if (typeof res === "object")
|
|
21625
|
+
return res;
|
|
21626
|
+
throw new Error(res);
|
|
21627
|
+
}
|
|
21628
|
+
function convert(data, inBits, outBits, pad) {
|
|
21629
|
+
var value = 0;
|
|
21630
|
+
var bits = 0;
|
|
21631
|
+
var maxV = (1 << outBits) - 1;
|
|
21632
|
+
var result = [];
|
|
21633
|
+
for (var i = 0;i < data.length; ++i) {
|
|
21634
|
+
value = value << inBits | data[i];
|
|
21635
|
+
bits += inBits;
|
|
21636
|
+
while (bits >= outBits) {
|
|
21637
|
+
bits -= outBits;
|
|
21638
|
+
result.push(value >> bits & maxV);
|
|
21639
|
+
}
|
|
21640
|
+
}
|
|
21641
|
+
if (pad) {
|
|
21642
|
+
if (bits > 0) {
|
|
21643
|
+
result.push(value << outBits - bits & maxV);
|
|
21644
|
+
}
|
|
21645
|
+
} else {
|
|
21646
|
+
if (bits >= inBits)
|
|
21647
|
+
return "Excess padding";
|
|
21648
|
+
if (value << outBits - bits & maxV)
|
|
21649
|
+
return "Non-zero padding";
|
|
21650
|
+
}
|
|
21651
|
+
return result;
|
|
21652
|
+
}
|
|
21653
|
+
function toWordsUnsafe(bytes2) {
|
|
21654
|
+
var res = convert(bytes2, 8, 5, true);
|
|
21655
|
+
if (Array.isArray(res))
|
|
21656
|
+
return res;
|
|
21657
|
+
}
|
|
21658
|
+
function toWords(bytes2) {
|
|
21659
|
+
var res = convert(bytes2, 8, 5, true);
|
|
21660
|
+
if (Array.isArray(res))
|
|
21661
|
+
return res;
|
|
21662
|
+
throw new Error(res);
|
|
21663
|
+
}
|
|
21664
|
+
function fromWordsUnsafe(words) {
|
|
21665
|
+
var res = convert(words, 5, 8, false);
|
|
21666
|
+
if (Array.isArray(res))
|
|
21667
|
+
return res;
|
|
21668
|
+
}
|
|
21669
|
+
function fromWords(words) {
|
|
21670
|
+
var res = convert(words, 5, 8, false);
|
|
21671
|
+
if (Array.isArray(res))
|
|
21672
|
+
return res;
|
|
21673
|
+
throw new Error(res);
|
|
21674
|
+
}
|
|
21675
|
+
var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
|
21676
|
+
var ALPHABET_MAP = {};
|
|
21677
|
+
for (z = 0;z < ALPHABET.length; z++) {
|
|
21678
|
+
x = ALPHABET.charAt(z);
|
|
21679
|
+
if (ALPHABET_MAP[x] !== undefined)
|
|
21680
|
+
throw new TypeError(x + " is ambiguous");
|
|
21681
|
+
ALPHABET_MAP[x] = z;
|
|
21682
|
+
}
|
|
21683
|
+
var x;
|
|
21684
|
+
var z;
|
|
21685
|
+
module.exports = {
|
|
21686
|
+
decodeUnsafe,
|
|
21687
|
+
decode,
|
|
21688
|
+
encode,
|
|
21689
|
+
toWordsUnsafe,
|
|
21690
|
+
toWords,
|
|
21691
|
+
fromWordsUnsafe,
|
|
21692
|
+
fromWords
|
|
21693
|
+
};
|
|
21694
|
+
});
|
|
21695
|
+
|
|
21696
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/bech32.js
|
|
21697
|
+
var require_bech324 = __commonJS((exports) => {
|
|
21698
|
+
function toBech32(prefix, data, limit) {
|
|
21699
|
+
const address = bech32.encode(prefix, bech32.toWords(data), limit);
|
|
21700
|
+
return address;
|
|
21701
|
+
}
|
|
21702
|
+
function fromBech32(address, limit = Infinity) {
|
|
21703
|
+
const decodedAddress = bech32.decode(address, limit);
|
|
21704
|
+
return {
|
|
21705
|
+
prefix: decodedAddress.prefix,
|
|
21706
|
+
data: new Uint8Array(bech32.fromWords(decodedAddress.words))
|
|
21707
|
+
};
|
|
21708
|
+
}
|
|
21709
|
+
function normalizeBech32(address) {
|
|
21710
|
+
const { prefix, data } = fromBech32(address);
|
|
21711
|
+
return toBech32(prefix, data);
|
|
21712
|
+
}
|
|
21713
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
21714
|
+
if (k2 === undefined)
|
|
21715
|
+
k2 = k;
|
|
21716
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21717
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21718
|
+
desc = { enumerable: true, get: function() {
|
|
21719
|
+
return m[k];
|
|
21720
|
+
} };
|
|
21721
|
+
}
|
|
21722
|
+
Object.defineProperty(o, k2, desc);
|
|
21723
|
+
} : function(o, m, k, k2) {
|
|
21724
|
+
if (k2 === undefined)
|
|
21725
|
+
k2 = k;
|
|
21726
|
+
o[k2] = m[k];
|
|
21727
|
+
});
|
|
21728
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
21729
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21730
|
+
} : function(o, v) {
|
|
21731
|
+
o["default"] = v;
|
|
21732
|
+
});
|
|
21733
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
21734
|
+
if (mod && mod.__esModule)
|
|
21735
|
+
return mod;
|
|
21736
|
+
var result = {};
|
|
21737
|
+
if (mod != null) {
|
|
21738
|
+
for (var k in mod)
|
|
21739
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
21740
|
+
__createBinding(result, mod, k);
|
|
21741
|
+
}
|
|
21742
|
+
__setModuleDefault(result, mod);
|
|
21743
|
+
return result;
|
|
21744
|
+
};
|
|
21745
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21746
|
+
exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = undefined;
|
|
21747
|
+
var bech32 = __importStar(require_bech323());
|
|
21748
|
+
exports.toBech32 = toBech32;
|
|
21749
|
+
exports.fromBech32 = fromBech32;
|
|
21750
|
+
exports.normalizeBech32 = normalizeBech32;
|
|
21751
|
+
});
|
|
21752
|
+
|
|
21753
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/hex.js
|
|
21754
|
+
var require_hex2 = __commonJS((exports) => {
|
|
21755
|
+
function toHex(data) {
|
|
21756
|
+
let out = "";
|
|
21757
|
+
for (const byte of data) {
|
|
21758
|
+
out += ("0" + byte.toString(16)).slice(-2);
|
|
21759
|
+
}
|
|
21760
|
+
return out;
|
|
21761
|
+
}
|
|
21762
|
+
function fromHex(hexstring) {
|
|
21763
|
+
if (hexstring.length % 2 !== 0) {
|
|
21764
|
+
throw new Error("hex string length must be a multiple of 2");
|
|
21765
|
+
}
|
|
21766
|
+
const out = new Uint8Array(hexstring.length / 2);
|
|
21767
|
+
for (let i = 0;i < out.length; i++) {
|
|
21768
|
+
const j = 2 * i;
|
|
21769
|
+
const hexByteAsString = hexstring.slice(j, j + 2);
|
|
21770
|
+
if (!hexByteAsString.match(/[0-9a-f]{2}/i)) {
|
|
21771
|
+
throw new Error("hex string contains invalid characters");
|
|
21772
|
+
}
|
|
21773
|
+
out[i] = parseInt(hexByteAsString, 16);
|
|
21774
|
+
}
|
|
21775
|
+
return out;
|
|
21776
|
+
}
|
|
21777
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21778
|
+
exports.fromHex = exports.toHex = undefined;
|
|
21779
|
+
exports.toHex = toHex;
|
|
21780
|
+
exports.fromHex = fromHex;
|
|
21781
|
+
});
|
|
21782
|
+
|
|
21783
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/rfc3339.js
|
|
21784
|
+
var require_rfc33392 = __commonJS((exports) => {
|
|
21785
|
+
function padded(integer, length = 2) {
|
|
21786
|
+
return integer.toString().padStart(length, "0");
|
|
21787
|
+
}
|
|
21788
|
+
function fromRfc3339(str) {
|
|
21789
|
+
const matches = rfc3339Matcher.exec(str);
|
|
21790
|
+
if (!matches) {
|
|
21791
|
+
throw new Error("Date string is not in RFC3339 format");
|
|
21792
|
+
}
|
|
21793
|
+
const year = +matches[1];
|
|
21794
|
+
const month = +matches[2];
|
|
21795
|
+
const day = +matches[3];
|
|
21796
|
+
const hour = +matches[4];
|
|
21797
|
+
const minute = +matches[5];
|
|
21798
|
+
const second = +matches[6];
|
|
21799
|
+
const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0;
|
|
21800
|
+
let tzOffsetSign;
|
|
21801
|
+
let tzOffsetHours;
|
|
21802
|
+
let tzOffsetMinutes;
|
|
21803
|
+
if (matches[8] === "Z") {
|
|
21804
|
+
tzOffsetSign = 1;
|
|
21805
|
+
tzOffsetHours = 0;
|
|
21806
|
+
tzOffsetMinutes = 0;
|
|
21807
|
+
} else {
|
|
21808
|
+
tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1;
|
|
21809
|
+
tzOffsetHours = +matches[8].substring(1, 3);
|
|
21810
|
+
tzOffsetMinutes = +matches[8].substring(4, 6);
|
|
21811
|
+
}
|
|
21812
|
+
const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60;
|
|
21813
|
+
const date = new Date;
|
|
21814
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
21815
|
+
date.setUTCHours(hour, minute, second, milliSeconds);
|
|
21816
|
+
return new Date(date.getTime() - tzOffset * 1000);
|
|
21817
|
+
}
|
|
21818
|
+
function toRfc3339(date) {
|
|
21819
|
+
const year = date.getUTCFullYear();
|
|
21820
|
+
const month = padded(date.getUTCMonth() + 1);
|
|
21821
|
+
const day = padded(date.getUTCDate());
|
|
21822
|
+
const hour = padded(date.getUTCHours());
|
|
21823
|
+
const minute = padded(date.getUTCMinutes());
|
|
21824
|
+
const second = padded(date.getUTCSeconds());
|
|
21825
|
+
const ms = padded(date.getUTCMilliseconds(), 3);
|
|
21826
|
+
return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`;
|
|
21827
|
+
}
|
|
21828
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21829
|
+
exports.toRfc3339 = exports.fromRfc3339 = undefined;
|
|
21830
|
+
var rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/;
|
|
21831
|
+
exports.fromRfc3339 = fromRfc3339;
|
|
21832
|
+
exports.toRfc3339 = toRfc3339;
|
|
21833
|
+
});
|
|
21834
|
+
|
|
21835
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/utf8.js
|
|
21836
|
+
var require_utf82 = __commonJS((exports) => {
|
|
21837
|
+
function toUtf8(str) {
|
|
21838
|
+
return new TextEncoder().encode(str);
|
|
21839
|
+
}
|
|
21840
|
+
function fromUtf8(data, lossy = false) {
|
|
21841
|
+
const fatal = !lossy;
|
|
21842
|
+
return new TextDecoder("utf-8", { fatal }).decode(data);
|
|
21843
|
+
}
|
|
21844
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21845
|
+
exports.fromUtf8 = exports.toUtf8 = undefined;
|
|
21846
|
+
exports.toUtf8 = toUtf8;
|
|
21847
|
+
exports.fromUtf8 = fromUtf8;
|
|
21848
|
+
});
|
|
21849
|
+
|
|
21850
|
+
// ../done-local-chain/node_modules/@cosmjs/encoding/build/index.js
|
|
21851
|
+
var require_build2 = __commonJS((exports) => {
|
|
21852
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21853
|
+
exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = undefined;
|
|
21854
|
+
var ascii_1 = require_ascii2();
|
|
21855
|
+
Object.defineProperty(exports, "fromAscii", { enumerable: true, get: function() {
|
|
21856
|
+
return ascii_1.fromAscii;
|
|
21857
|
+
} });
|
|
21858
|
+
Object.defineProperty(exports, "toAscii", { enumerable: true, get: function() {
|
|
21859
|
+
return ascii_1.toAscii;
|
|
21860
|
+
} });
|
|
21861
|
+
var base64_1 = require_base642();
|
|
21862
|
+
Object.defineProperty(exports, "fromBase64", { enumerable: true, get: function() {
|
|
21863
|
+
return base64_1.fromBase64;
|
|
21864
|
+
} });
|
|
21865
|
+
Object.defineProperty(exports, "toBase64", { enumerable: true, get: function() {
|
|
21866
|
+
return base64_1.toBase64;
|
|
21867
|
+
} });
|
|
21868
|
+
var bech32_1 = require_bech324();
|
|
21869
|
+
Object.defineProperty(exports, "fromBech32", { enumerable: true, get: function() {
|
|
21870
|
+
return bech32_1.fromBech32;
|
|
21871
|
+
} });
|
|
21872
|
+
Object.defineProperty(exports, "normalizeBech32", { enumerable: true, get: function() {
|
|
21873
|
+
return bech32_1.normalizeBech32;
|
|
21874
|
+
} });
|
|
21875
|
+
Object.defineProperty(exports, "toBech32", { enumerable: true, get: function() {
|
|
21876
|
+
return bech32_1.toBech32;
|
|
21877
|
+
} });
|
|
21878
|
+
var hex_1 = require_hex2();
|
|
21879
|
+
Object.defineProperty(exports, "fromHex", { enumerable: true, get: function() {
|
|
21880
|
+
return hex_1.fromHex;
|
|
21881
|
+
} });
|
|
21882
|
+
Object.defineProperty(exports, "toHex", { enumerable: true, get: function() {
|
|
21883
|
+
return hex_1.toHex;
|
|
21884
|
+
} });
|
|
21885
|
+
var rfc3339_1 = require_rfc33392();
|
|
21886
|
+
Object.defineProperty(exports, "fromRfc3339", { enumerable: true, get: function() {
|
|
21887
|
+
return rfc3339_1.fromRfc3339;
|
|
21888
|
+
} });
|
|
21889
|
+
Object.defineProperty(exports, "toRfc3339", { enumerable: true, get: function() {
|
|
21890
|
+
return rfc3339_1.toRfc3339;
|
|
21891
|
+
} });
|
|
21892
|
+
var utf8_1 = require_utf82();
|
|
21893
|
+
Object.defineProperty(exports, "fromUtf8", { enumerable: true, get: function() {
|
|
21894
|
+
return utf8_1.fromUtf8;
|
|
21895
|
+
} });
|
|
21896
|
+
Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function() {
|
|
21897
|
+
return utf8_1.toUtf8;
|
|
21898
|
+
} });
|
|
21899
|
+
});
|
|
21900
|
+
|
|
21455
21901
|
// ../../node_modules/fast-decode-uri-component/index.js
|
|
21456
21902
|
var require_fast_decode_uri_component = __commonJS((exports, module) => {
|
|
21457
21903
|
function decodeURIComponent2(uri) {
|
|
@@ -26835,6 +27281,7 @@ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:f
|
|
|
26835
27281
|
import * as fs2 from "node:fs/promises";
|
|
26836
27282
|
import path from "node:path";
|
|
26837
27283
|
import { TextDecoder as TextDecoder2 } from "node:util";
|
|
27284
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
26838
27285
|
|
|
26839
27286
|
// ../../node_modules/commander/esm.mjs
|
|
26840
27287
|
var import__ = __toESM(require_commander(), 1);
|
|
@@ -27911,6 +28358,7 @@ class DoneInstance {
|
|
|
27911
28358
|
var Done = new DoneInstance;
|
|
27912
28359
|
// ../done-local-chain/src/chain.ts
|
|
27913
28360
|
var import_cosmwasm_vm_js = __toESM(require_dist2(), 1);
|
|
28361
|
+
var import_encoding = __toESM(require_build2(), 1);
|
|
27914
28362
|
var import_backend = __toESM(require_backend(), 1);
|
|
27915
28363
|
var import_bech32 = __toESM(require_dist(), 1);
|
|
27916
28364
|
|
|
@@ -28441,7 +28889,7 @@ class DoneLocalChain {
|
|
|
28441
28889
|
const height = this.blockHeight;
|
|
28442
28890
|
const blockTime = this.blockTime;
|
|
28443
28891
|
try {
|
|
28444
|
-
const region = record.vm[entrypoint](env, info, msg);
|
|
28892
|
+
const region = entrypoint === "query" ? record.vm[entrypoint](env, msg) : record.vm[entrypoint](env, info, msg);
|
|
28445
28893
|
const json = region?.json ?? { err: "contract returned empty response" };
|
|
28446
28894
|
this.emitContractEvent(record, entrypoint, env, info, json, height, blockTime);
|
|
28447
28895
|
return json;
|
|
@@ -28489,6 +28937,23 @@ class DoneLocalChain {
|
|
|
28489
28937
|
view.setUint32(28, this.nextAddressNonce++);
|
|
28490
28938
|
return import_bech32.bech32.encode(this.bech32Prefix, import_bech32.bech32.toWords(data));
|
|
28491
28939
|
}
|
|
28940
|
+
restoreStorage(address, entries) {
|
|
28941
|
+
const record = this.contracts.get(address);
|
|
28942
|
+
if (!record) {
|
|
28943
|
+
throw new Error(`contract ${address} not found`);
|
|
28944
|
+
}
|
|
28945
|
+
const storage = record.backend.storage;
|
|
28946
|
+
if (!(storage instanceof import_backend.BasicKVIterStorage)) {
|
|
28947
|
+
return;
|
|
28948
|
+
}
|
|
28949
|
+
for (const entry of entries) {
|
|
28950
|
+
if (!entry.key || !entry.value)
|
|
28951
|
+
continue;
|
|
28952
|
+
const keyBytes = import_encoding.fromBase64(entry.key);
|
|
28953
|
+
const valueBytes = import_encoding.fromBase64(entry.value);
|
|
28954
|
+
storage.set(keyBytes, valueBytes);
|
|
28955
|
+
}
|
|
28956
|
+
}
|
|
28492
28957
|
}
|
|
28493
28958
|
// ../done-local-chain/src/js-contract.ts
|
|
28494
28959
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -43080,7 +43545,7 @@ var sharedRouteSchemas = {
|
|
|
43080
43545
|
};
|
|
43081
43546
|
// ../done-http-local/src/server.ts
|
|
43082
43547
|
async function createDoneHttpLocalServer(config, chain) {
|
|
43083
|
-
const runtime = chain ??
|
|
43548
|
+
const runtime = chain ?? loadChainWithArtifacts();
|
|
43084
43549
|
if (config.scriptPath) {
|
|
43085
43550
|
await deployJsContract({
|
|
43086
43551
|
chain: runtime,
|
|
@@ -43271,6 +43736,9 @@ function unwrapQueryResult(result) {
|
|
|
43271
43736
|
if (result.err) {
|
|
43272
43737
|
throw new Error(result.err);
|
|
43273
43738
|
}
|
|
43739
|
+
if (typeof result.ok === "string") {
|
|
43740
|
+
return decodeData(result.ok);
|
|
43741
|
+
}
|
|
43274
43742
|
if (result.ok?.data) {
|
|
43275
43743
|
return decodeData(result.ok.data);
|
|
43276
43744
|
}
|
|
@@ -43772,8 +44240,7 @@ interface SetGreetingBody {
|
|
|
43772
44240
|
|
|
43773
44241
|
export default Done.serve()
|
|
43774
44242
|
.instantiate(async () => {
|
|
43775
|
-
|
|
43776
|
-
if (!existing) {
|
|
44243
|
+
if (!(await Greeting.exists())) {
|
|
43777
44244
|
await Greeting.save("${defaultGreeting}");
|
|
43778
44245
|
}
|
|
43779
44246
|
})
|
|
@@ -43912,7 +44379,7 @@ function updateDependencyIfPresent(pkg, name, version) {
|
|
|
43912
44379
|
}
|
|
43913
44380
|
async function syncWorkspaceDependencyVersions(targetDir) {
|
|
43914
44381
|
await updatePackageJson(path.join(targetDir, "package.json"), (pkg) => {
|
|
43915
|
-
ensureDependency(pkg, "devDependencies", "@donezone/cli",
|
|
44382
|
+
ensureDependency(pkg, "devDependencies", "@donezone/cli", CLI_DEPENDENCY_SPEC);
|
|
43916
44383
|
ensureDependency(pkg, "devDependencies", "done.zone", DONE_ZONE_VERSION_RANGE);
|
|
43917
44384
|
});
|
|
43918
44385
|
await updatePackageJson(path.join(targetDir, "frontend", "package.json"), (pkg) => {
|
|
@@ -44234,6 +44701,31 @@ async function readDevEnvFile(file2) {
|
|
|
44234
44701
|
}
|
|
44235
44702
|
return entries;
|
|
44236
44703
|
}
|
|
44704
|
+
async function readStorageSnapshot(file2) {
|
|
44705
|
+
try {
|
|
44706
|
+
const raw = await fs2.readFile(file2, "utf8");
|
|
44707
|
+
return JSON.parse(raw);
|
|
44708
|
+
} catch (error) {
|
|
44709
|
+
if (error.code === "ENOENT") {
|
|
44710
|
+
return null;
|
|
44711
|
+
}
|
|
44712
|
+
throw error;
|
|
44713
|
+
}
|
|
44714
|
+
}
|
|
44715
|
+
function extractStorageEntries(snapshot) {
|
|
44716
|
+
if (!snapshot?.entries) {
|
|
44717
|
+
return [];
|
|
44718
|
+
}
|
|
44719
|
+
const entries = [];
|
|
44720
|
+
for (const entry of snapshot.entries) {
|
|
44721
|
+
const keyBase64 = entry.key?.base64;
|
|
44722
|
+
const valueBase64 = entry.value?.base64;
|
|
44723
|
+
if (!keyBase64 || !valueBase64)
|
|
44724
|
+
continue;
|
|
44725
|
+
entries.push({ key: keyBase64, value: valueBase64 });
|
|
44726
|
+
}
|
|
44727
|
+
return entries;
|
|
44728
|
+
}
|
|
44237
44729
|
function toEnvVarKey(name) {
|
|
44238
44730
|
return name.replace(/[^a-zA-Z0-9]+/g, "_").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
|
|
44239
44731
|
}
|
|
@@ -44262,6 +44754,7 @@ function openBrowser(url) {
|
|
|
44262
44754
|
var packageMetadata = readCliPackageMetadata();
|
|
44263
44755
|
var CLI_VERSION = normalizeVersion(packageMetadata.version) ?? "0.0.0-spec";
|
|
44264
44756
|
var CLI_VERSION_RANGE = toCaretRange(CLI_VERSION);
|
|
44757
|
+
var CLI_DEPENDENCY_SPEC = process.env.DONE_CLI_LOCAL_SPEC ?? CLI_VERSION_RANGE;
|
|
44265
44758
|
var DONE_ZONE_VERSION = normalizeVersion(packageMetadata.doneZoneVersion) ?? CLI_VERSION;
|
|
44266
44759
|
var DONE_ZONE_VERSION_RANGE = toCaretRange(DONE_ZONE_VERSION);
|
|
44267
44760
|
var DONE_CLIENT_VERSION = normalizeVersion(packageMetadata.doneClientVersion) ?? CLI_VERSION;
|
|
@@ -44279,6 +44772,11 @@ if (typeof bunRuntime === "undefined") {
|
|
|
44279
44772
|
process.exit(rerun.status ?? 1);
|
|
44280
44773
|
}
|
|
44281
44774
|
var DEFAULT_TEMPLATE_REPO = "https://github.com/mccallofthewild/done-template.git";
|
|
44775
|
+
var CLI_DIR = path.dirname(fileURLToPath2(import.meta.url));
|
|
44776
|
+
var CLI_ARTIFACTS_DIR = path.resolve(CLI_DIR, "..", "artifacts");
|
|
44777
|
+
if (!process.env.DONE_ARTIFACTS_DIR && existsSync2(CLI_ARTIFACTS_DIR)) {
|
|
44778
|
+
process.env.DONE_ARTIFACTS_DIR = CLI_ARTIFACTS_DIR;
|
|
44779
|
+
}
|
|
44282
44780
|
var program2 = new Command;
|
|
44283
44781
|
program2.name("done").description("Done developer toolkit (spec-first stub)").version(CLI_VERSION);
|
|
44284
44782
|
program2.command("build").description("Bundle Done contracts defined in done.json").option("-j, --contracts <path>", "Path to done.json").option("-n, --name <name...>", "Filter contract names").action(async (options) => {
|
|
@@ -44480,9 +44978,13 @@ class DoneDevOrchestrator {
|
|
|
44480
44978
|
if (deployment.result.err) {
|
|
44481
44979
|
throw new Error(`Failed to deploy ${contract.name}: ${deployment.result.err}`);
|
|
44482
44980
|
}
|
|
44981
|
+
const restored = await this.restoreStorageFromSnapshot(contract, deployment.address);
|
|
44483
44982
|
contract.address = deployment.address;
|
|
44484
44983
|
this.chain.advanceBlock();
|
|
44485
44984
|
this.logInfo(`${import_picocolors.default.green("\u2022")} ${contract.name} deployed at ${deployment.address}`);
|
|
44985
|
+
if (restored) {
|
|
44986
|
+
this.logInfo(` ${import_picocolors.default.dim("\u21BA state")}: restored snapshot for ${contract.name}`);
|
|
44987
|
+
}
|
|
44486
44988
|
await this.dumpContractStorage(contract);
|
|
44487
44989
|
}
|
|
44488
44990
|
}
|
|
@@ -44577,6 +45079,30 @@ class DoneDevOrchestrator {
|
|
|
44577
45079
|
const filePath = path.join(storageDir, `${contract.slug}.json`);
|
|
44578
45080
|
await writeJson(filePath, snapshot);
|
|
44579
45081
|
}
|
|
45082
|
+
async restoreStorageFromSnapshot(contract, address) {
|
|
45083
|
+
if (!this.chain) {
|
|
45084
|
+
return false;
|
|
45085
|
+
}
|
|
45086
|
+
const filePath = this.resolveStorageSnapshotPath(contract);
|
|
45087
|
+
try {
|
|
45088
|
+
const snapshot = await readStorageSnapshot(filePath);
|
|
45089
|
+
const entries = extractStorageEntries(snapshot);
|
|
45090
|
+
if (entries.length === 0) {
|
|
45091
|
+
return false;
|
|
45092
|
+
}
|
|
45093
|
+
this.chain.restoreStorage(address, entries);
|
|
45094
|
+
return true;
|
|
45095
|
+
} catch (error) {
|
|
45096
|
+
if (error.code !== "ENOENT") {
|
|
45097
|
+
this.logWarn(`Unable to restore storage for ${contract.name}: ${error.message}`);
|
|
45098
|
+
}
|
|
45099
|
+
return false;
|
|
45100
|
+
}
|
|
45101
|
+
}
|
|
45102
|
+
resolveStorageSnapshotPath(contract) {
|
|
45103
|
+
const storageDir = path.join(this.options.workspace.root, ".done", "storage");
|
|
45104
|
+
return path.join(storageDir, `${contract.slug}.json`);
|
|
45105
|
+
}
|
|
44580
45106
|
async launchFrontend() {
|
|
44581
45107
|
const frontend = this.options.devConfig.frontend;
|
|
44582
45108
|
if (!existsSync2(frontend.cwd)) {
|