@fastxyz/cli 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -165,13 +165,36 @@ import {
165
165
  } from "./chunk-VOHYNW3B.js";
166
166
  import "./chunk-MWATGKBS.js";
167
167
  import {
168
- NetworkConfigService
169
- } from "./chunk-F4CXF26J.js";
168
+ AccountInfoResponseFromRest,
169
+ AddressFromRest,
170
+ EscrowJobRecordFromRest,
171
+ EscrowJobWithCertsFromRest,
172
+ GetAccountInfoInput,
173
+ GetEscrowJobInput,
174
+ GetEscrowJobsInput,
175
+ GetPendingMultisigInput,
176
+ GetTokenInfoInput,
177
+ GetTransactionCertificatesInput,
178
+ LatestTransactionVersion,
179
+ NetworkConfigService,
180
+ PrivateKeyFromInput,
181
+ ProxySubmitTransactionResultFromRest,
182
+ SignatureFromInput,
183
+ SignatureOrMultiSigFromBcs,
184
+ TokenIdFromRest,
185
+ TokenInfoResponseFromRest,
186
+ TransactionCertificateFromRest,
187
+ TransactionCertificateFromRpc,
188
+ TransactionEnvelopeFromRest,
189
+ VersionedTransactionFromBcs,
190
+ bcs_layout_exports,
191
+ getTransactionVersionConfig
192
+ } from "./chunk-DITXH2ZY.js";
170
193
  import {
171
194
  AppConfigLive,
172
195
  getAppName,
173
196
  getVersion
174
- } from "./chunk-ECO24H3M.js";
197
+ } from "./chunk-UZZ2O26Y.js";
175
198
  import {
176
199
  AccountExistsError,
177
200
  AccountNotFoundError,
@@ -608,7 +631,7 @@ import { Cause, Effect as Effect2, Exit, Option } from "effect";
608
631
  import { Data as Data2 } from "effect";
609
632
  import { Data as Data3 } from "effect";
610
633
  import { Data as Data4 } from "effect";
611
- import { Effect as Effect3, Schema as Schema19 } from "effect";
634
+ import { Effect as Effect3, Schema } from "effect";
612
635
 
613
636
  // ../../node_modules/.pnpm/json-with-bigint@3.5.8/node_modules/json-with-bigint/json-with-bigint.js
614
637
  var intRegex = /^-?\d+$/;
@@ -713,2202 +736,8 @@ var JSONParse = (text, reviver) => {
713
736
  );
714
737
  };
715
738
 
716
- // ../../packages/fast-schema/dist/index.js
717
- import { Schema as Schema6 } from "effect";
718
- import { bech32m } from "bech32";
719
- import { ParseResult, Schema } from "effect";
720
- import { Schema as Schema2 } from "effect";
721
- import { Schema as Schema3, String as Str } from "effect";
722
- import { Either, ParseResult as ParseResult2, Schema as Schema4 } from "effect";
723
- import { Schema as Schema5 } from "effect";
724
- import { Schema as Schema7 } from "effect";
725
- import { Schema as Schema8 } from "effect";
726
- import { Schema as Schema9 } from "effect";
727
-
728
- // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/uleb.mjs
729
- function ulebEncode(num) {
730
- let bigNum = BigInt(num);
731
- const arr = [];
732
- let len = 0;
733
- if (bigNum === 0n) return [0];
734
- while (bigNum > 0) {
735
- arr[len] = Number(bigNum & 127n);
736
- bigNum >>= 7n;
737
- if (bigNum > 0n) arr[len] |= 128;
738
- len += 1;
739
- }
740
- return arr;
741
- }
742
- function ulebDecode(arr) {
743
- let total = 0n;
744
- let shift = 0n;
745
- let len = 0;
746
- while (true) {
747
- if (len >= arr.length) throw new Error("ULEB decode error: buffer overflow");
748
- const byte = arr[len];
749
- len += 1;
750
- total += BigInt(byte & 127) << shift;
751
- if ((byte & 128) === 0) break;
752
- shift += 7n;
753
- }
754
- if (total > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error("ULEB decode error: value exceeds MAX_SAFE_INTEGER");
755
- return {
756
- value: Number(total),
757
- length: len
758
- };
759
- }
760
-
761
- // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/reader.mjs
762
- var BcsReader = class {
763
- /**
764
- * @param {Uint8Array} data Data to use as a buffer.
765
- */
766
- constructor(data) {
767
- this.bytePosition = 0;
768
- this.dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
769
- }
770
- /**
771
- * Shift current cursor position by `bytes`.
772
- *
773
- * @param {Number} bytes Number of bytes to
774
- * @returns {this} Self for possible chaining.
775
- */
776
- shift(bytes) {
777
- this.bytePosition += bytes;
778
- return this;
779
- }
780
- /**
781
- * Read U8 value from the buffer and shift cursor by 1.
782
- * @returns
783
- */
784
- read8() {
785
- const value = this.dataView.getUint8(this.bytePosition);
786
- this.shift(1);
787
- return value;
788
- }
789
- /**
790
- * Read U16 value from the buffer and shift cursor by 2.
791
- * @returns
792
- */
793
- read16() {
794
- const value = this.dataView.getUint16(this.bytePosition, true);
795
- this.shift(2);
796
- return value;
797
- }
798
- /**
799
- * Read U32 value from the buffer and shift cursor by 4.
800
- * @returns
801
- */
802
- read32() {
803
- const value = this.dataView.getUint32(this.bytePosition, true);
804
- this.shift(4);
805
- return value;
806
- }
807
- /**
808
- * Read U64 value from the buffer and shift cursor by 8.
809
- * @returns
810
- */
811
- read64() {
812
- const value1 = this.read32();
813
- const result2 = this.read32().toString(16) + value1.toString(16).padStart(8, "0");
814
- return BigInt("0x" + result2).toString(10);
815
- }
816
- /**
817
- * Read U128 value from the buffer and shift cursor by 16.
818
- */
819
- read128() {
820
- const value1 = BigInt(this.read64());
821
- const result2 = BigInt(this.read64()).toString(16) + value1.toString(16).padStart(16, "0");
822
- return BigInt("0x" + result2).toString(10);
823
- }
824
- /**
825
- * Read U128 value from the buffer and shift cursor by 32.
826
- * @returns
827
- */
828
- read256() {
829
- const value1 = BigInt(this.read128());
830
- const result2 = BigInt(this.read128()).toString(16) + value1.toString(16).padStart(32, "0");
831
- return BigInt("0x" + result2).toString(10);
832
- }
833
- /**
834
- * Read `num` number of bytes from the buffer and shift cursor by `num`.
835
- * @param num Number of bytes to read.
836
- */
837
- readBytes(num) {
838
- const start = this.bytePosition + this.dataView.byteOffset;
839
- const value = new Uint8Array(this.dataView.buffer, start, num);
840
- this.shift(num);
841
- return value;
842
- }
843
- /**
844
- * Read ULEB value - an integer of varying size. Used for enum indexes and
845
- * vector lengths.
846
- * @returns {Number} The ULEB value.
847
- */
848
- readULEB() {
849
- const start = this.bytePosition + this.dataView.byteOffset;
850
- const { value, length } = ulebDecode(new Uint8Array(this.dataView.buffer, start));
851
- this.shift(length);
852
- return value;
853
- }
854
- /**
855
- * Read a BCS vector: read a length and then apply function `cb` X times
856
- * where X is the length of the vector, defined as ULEB in BCS bytes.
857
- * @param cb Callback to process elements of vector.
858
- * @returns {Array<Any>} Array of the resulting values, returned by callback.
859
- */
860
- readVec(cb) {
861
- const length = this.readULEB();
862
- const result2 = [];
863
- for (let i = 0; i < length; i++) result2.push(cb(this, i, length));
864
- return result2;
865
- }
866
- };
867
-
868
- // ../../node_modules/.pnpm/@scure+base@2.0.0/node_modules/@scure/base/index.js
869
- function isBytes2(a) {
870
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
871
- }
872
- function isArrayOf(isString, arr) {
873
- if (!Array.isArray(arr))
874
- return false;
875
- if (arr.length === 0)
876
- return true;
877
- if (isString) {
878
- return arr.every((item) => typeof item === "string");
879
- } else {
880
- return arr.every((item) => Number.isSafeInteger(item));
881
- }
882
- }
883
- function astr(label, input) {
884
- if (typeof input !== "string")
885
- throw new Error(`${label}: string expected`);
886
- return true;
887
- }
888
- function anumber2(n) {
889
- if (!Number.isSafeInteger(n))
890
- throw new Error(`invalid integer: ${n}`);
891
- }
892
- function aArr(input) {
893
- if (!Array.isArray(input))
894
- throw new Error("array expected");
895
- }
896
- function astrArr(label, input) {
897
- if (!isArrayOf(true, input))
898
- throw new Error(`${label}: array of strings expected`);
899
- }
900
- function anumArr(label, input) {
901
- if (!isArrayOf(false, input))
902
- throw new Error(`${label}: array of numbers expected`);
903
- }
904
- // @__NO_SIDE_EFFECTS__
905
- function chain(...args) {
906
- const id = (a) => a;
907
- const wrap3 = (a, b) => (c) => a(b(c));
908
- const encode5 = args.map((x) => x.encode).reduceRight(wrap3, id);
909
- const decode2 = args.map((x) => x.decode).reduce(wrap3, id);
910
- return { encode: encode5, decode: decode2 };
911
- }
912
- // @__NO_SIDE_EFFECTS__
913
- function alphabet(letters) {
914
- const lettersA = typeof letters === "string" ? letters.split("") : letters;
915
- const len = lettersA.length;
916
- astrArr("alphabet", lettersA);
917
- const indexes = new Map(lettersA.map((l, i) => [l, i]));
918
- return {
919
- encode: (digits) => {
920
- aArr(digits);
921
- return digits.map((i) => {
922
- if (!Number.isSafeInteger(i) || i < 0 || i >= len)
923
- throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${letters}`);
924
- return lettersA[i];
925
- });
926
- },
927
- decode: (input) => {
928
- aArr(input);
929
- return input.map((letter) => {
930
- astr("alphabet.decode", letter);
931
- const i = indexes.get(letter);
932
- if (i === void 0)
933
- throw new Error(`Unknown letter: "${letter}". Allowed: ${letters}`);
934
- return i;
935
- });
936
- }
937
- };
938
- }
939
- // @__NO_SIDE_EFFECTS__
940
- function join(separator = "") {
941
- astr("join", separator);
942
- return {
943
- encode: (from14) => {
944
- astrArr("join.decode", from14);
945
- return from14.join(separator);
946
- },
947
- decode: (to) => {
948
- astr("join.decode", to);
949
- return to.split(separator);
950
- }
951
- };
952
- }
953
- function convertRadix(data, from14, to) {
954
- if (from14 < 2)
955
- throw new Error(`convertRadix: invalid from=${from14}, base cannot be less than 2`);
956
- if (to < 2)
957
- throw new Error(`convertRadix: invalid to=${to}, base cannot be less than 2`);
958
- aArr(data);
959
- if (!data.length)
960
- return [];
961
- let pos = 0;
962
- const res = [];
963
- const digits = Array.from(data, (d) => {
964
- anumber2(d);
965
- if (d < 0 || d >= from14)
966
- throw new Error(`invalid integer: ${d}`);
967
- return d;
968
- });
969
- const dlen = digits.length;
970
- while (true) {
971
- let carry = 0;
972
- let done = true;
973
- for (let i = pos; i < dlen; i++) {
974
- const digit = digits[i];
975
- const fromCarry = from14 * carry;
976
- const digitBase = fromCarry + digit;
977
- if (!Number.isSafeInteger(digitBase) || fromCarry / from14 !== carry || digitBase - digit !== fromCarry) {
978
- throw new Error("convertRadix: carry overflow");
979
- }
980
- const div = digitBase / to;
981
- carry = digitBase % to;
982
- const rounded = Math.floor(div);
983
- digits[i] = rounded;
984
- if (!Number.isSafeInteger(rounded) || rounded * to + carry !== digitBase)
985
- throw new Error("convertRadix: carry overflow");
986
- if (!done)
987
- continue;
988
- else if (!rounded)
989
- pos = i;
990
- else
991
- done = false;
992
- }
993
- res.push(carry);
994
- if (done)
995
- break;
996
- }
997
- for (let i = 0; i < data.length - 1 && data[i] === 0; i++)
998
- res.push(0);
999
- return res.reverse();
1000
- }
1001
- // @__NO_SIDE_EFFECTS__
1002
- function radix(num) {
1003
- anumber2(num);
1004
- const _256 = 2 ** 8;
1005
- return {
1006
- encode: (bytes) => {
1007
- if (!isBytes2(bytes))
1008
- throw new Error("radix.encode input should be Uint8Array");
1009
- return convertRadix(Array.from(bytes), _256, num);
1010
- },
1011
- decode: (digits) => {
1012
- anumArr("radix.decode", digits);
1013
- return Uint8Array.from(convertRadix(digits, num, _256));
1014
- }
1015
- };
1016
- }
1017
- var genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join(""));
1018
- var base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
1019
-
1020
- // ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/b58.mjs
1021
- var toBase58 = (buffer2) => base58.encode(buffer2);
1022
- var fromBase58 = (str) => base58.decode(str);
1023
-
1024
- // ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/b64.mjs
1025
- function fromBase64(base64String) {
1026
- return Uint8Array.from(atob(base64String), (char) => char.charCodeAt(0));
1027
- }
1028
- var CHUNK_SIZE = 8192;
1029
- function toBase64(bytes) {
1030
- if (bytes.length < CHUNK_SIZE) return btoa(String.fromCharCode(...bytes));
1031
- let output = "";
1032
- for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
1033
- const chunk = bytes.slice(i, i + CHUNK_SIZE);
1034
- output += String.fromCharCode(...chunk);
1035
- }
1036
- return btoa(output);
1037
- }
1038
-
1039
- // ../../node_modules/.pnpm/@mysten+utils@0.3.1/node_modules/@mysten/utils/dist/hex.mjs
1040
- function fromHex2(hexStr) {
1041
- const normalized = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
1042
- const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}`;
1043
- const intArr = padded.match(/[0-9a-fA-F]{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
1044
- if (intArr.length !== padded.length / 2) throw new Error(`Invalid hex string ${hexStr}`);
1045
- return Uint8Array.from(intArr);
1046
- }
1047
- function toHex2(bytes) {
1048
- return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
1049
- }
1050
-
1051
- // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/utils.mjs
1052
- function encodeStr(data, encoding) {
1053
- switch (encoding) {
1054
- case "base58":
1055
- return toBase58(data);
1056
- case "base64":
1057
- return toBase64(data);
1058
- case "hex":
1059
- return toHex2(data);
1060
- default:
1061
- throw new Error("Unsupported encoding, supported values are: base64, hex");
1062
- }
1063
- }
1064
-
1065
- // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/writer.mjs
1066
- var BcsWriter = class {
1067
- constructor({ initialSize = 1024, maxSize = Infinity, allocateSize = 1024 } = {}) {
1068
- this.bytePosition = 0;
1069
- this.size = initialSize;
1070
- this.maxSize = maxSize;
1071
- this.allocateSize = allocateSize;
1072
- this.dataView = new DataView(new ArrayBuffer(initialSize));
1073
- }
1074
- ensureSizeOrGrow(bytes) {
1075
- const requiredSize = this.bytePosition + bytes;
1076
- if (requiredSize > this.size) {
1077
- const nextSize = Math.min(this.maxSize, Math.max(this.size + requiredSize, this.size + this.allocateSize));
1078
- if (requiredSize > nextSize) throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${requiredSize}`);
1079
- this.size = nextSize;
1080
- const nextBuffer = new ArrayBuffer(this.size);
1081
- new Uint8Array(nextBuffer).set(new Uint8Array(this.dataView.buffer));
1082
- this.dataView = new DataView(nextBuffer);
1083
- }
1084
- }
1085
- /**
1086
- * Shift current cursor position by `bytes`.
1087
- *
1088
- * @param {Number} bytes Number of bytes to
1089
- * @returns {this} Self for possible chaining.
1090
- */
1091
- shift(bytes) {
1092
- this.bytePosition += bytes;
1093
- return this;
1094
- }
1095
- /**
1096
- * Write a U8 value into a buffer and shift cursor position by 1.
1097
- * @param {Number} value Value to write.
1098
- * @returns {this}
1099
- */
1100
- write8(value) {
1101
- this.ensureSizeOrGrow(1);
1102
- this.dataView.setUint8(this.bytePosition, Number(value));
1103
- return this.shift(1);
1104
- }
1105
- /**
1106
- * Write a U8 value into a buffer and shift cursor position by 1.
1107
- * @param {Number} value Value to write.
1108
- * @returns {this}
1109
- */
1110
- writeBytes(bytes) {
1111
- this.ensureSizeOrGrow(bytes.length);
1112
- for (let i = 0; i < bytes.length; i++) this.dataView.setUint8(this.bytePosition + i, bytes[i]);
1113
- return this.shift(bytes.length);
1114
- }
1115
- /**
1116
- * Write a U16 value into a buffer and shift cursor position by 2.
1117
- * @param {Number} value Value to write.
1118
- * @returns {this}
1119
- */
1120
- write16(value) {
1121
- this.ensureSizeOrGrow(2);
1122
- this.dataView.setUint16(this.bytePosition, Number(value), true);
1123
- return this.shift(2);
1124
- }
1125
- /**
1126
- * Write a U32 value into a buffer and shift cursor position by 4.
1127
- * @param {Number} value Value to write.
1128
- * @returns {this}
1129
- */
1130
- write32(value) {
1131
- this.ensureSizeOrGrow(4);
1132
- this.dataView.setUint32(this.bytePosition, Number(value), true);
1133
- return this.shift(4);
1134
- }
1135
- /**
1136
- * Write a U64 value into a buffer and shift cursor position by 8.
1137
- * @param {bigint} value Value to write.
1138
- * @returns {this}
1139
- */
1140
- write64(value) {
1141
- toLittleEndian(BigInt(value), 8).forEach((el) => this.write8(el));
1142
- return this;
1143
- }
1144
- /**
1145
- * Write a U128 value into a buffer and shift cursor position by 16.
1146
- *
1147
- * @param {bigint} value Value to write.
1148
- * @returns {this}
1149
- */
1150
- write128(value) {
1151
- toLittleEndian(BigInt(value), 16).forEach((el) => this.write8(el));
1152
- return this;
1153
- }
1154
- /**
1155
- * Write a U256 value into a buffer and shift cursor position by 16.
1156
- *
1157
- * @param {bigint} value Value to write.
1158
- * @returns {this}
1159
- */
1160
- write256(value) {
1161
- toLittleEndian(BigInt(value), 32).forEach((el) => this.write8(el));
1162
- return this;
1163
- }
1164
- /**
1165
- * Write a ULEB value into a buffer and shift cursor position by number of bytes
1166
- * written.
1167
- * @param {Number} value Value to write.
1168
- * @returns {this}
1169
- */
1170
- writeULEB(value) {
1171
- ulebEncode(value).forEach((el) => this.write8(el));
1172
- return this;
1173
- }
1174
- /**
1175
- * Write a vector into a buffer by first writing the vector length and then calling
1176
- * a callback on each passed value.
1177
- *
1178
- * @param {Array<Any>} vector Array of elements to write.
1179
- * @param {WriteVecCb} cb Callback to call on each element of the vector.
1180
- * @returns {this}
1181
- */
1182
- writeVec(vector2, cb) {
1183
- this.writeULEB(vector2.length);
1184
- Array.from(vector2).forEach((el, i) => cb(this, el, i, vector2.length));
1185
- return this;
1186
- }
1187
- /**
1188
- * Adds support for iterations over the object.
1189
- * @returns {Uint8Array}
1190
- */
1191
- *[Symbol.iterator]() {
1192
- for (let i = 0; i < this.bytePosition; i++) yield this.dataView.getUint8(i);
1193
- return this.toBytes();
1194
- }
1195
- /**
1196
- * Get underlying buffer taking only value bytes (in case initial buffer size was bigger).
1197
- * @returns {Uint8Array} Resulting bcs.
1198
- */
1199
- toBytes() {
1200
- return new Uint8Array(this.dataView.buffer.slice(0, this.bytePosition));
1201
- }
1202
- /**
1203
- * Represent data as 'hex' or 'base64'
1204
- * @param encoding Encoding to use: 'base64' or 'hex'
1205
- */
1206
- toString(encoding) {
1207
- return encodeStr(this.toBytes(), encoding);
1208
- }
1209
- };
1210
- function toLittleEndian(bigint, size5) {
1211
- const result2 = new Uint8Array(size5);
1212
- let i = 0;
1213
- while (bigint > 0) {
1214
- result2[i] = Number(bigint % BigInt(256));
1215
- bigint = bigint / BigInt(256);
1216
- i += 1;
1217
- }
1218
- return result2;
1219
- }
1220
-
1221
- // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/bcs-type.mjs
1222
- var BcsType = class BcsType2 {
1223
- #write;
1224
- #serialize;
1225
- constructor(options) {
1226
- this.name = options.name;
1227
- this.read = options.read;
1228
- this.serializedSize = options.serializedSize ?? (() => null);
1229
- this.#write = options.write;
1230
- this.#serialize = options.serialize ?? ((value, options$1) => {
1231
- const writer = new BcsWriter({
1232
- initialSize: this.serializedSize(value) ?? void 0,
1233
- ...options$1
1234
- });
1235
- this.#write(value, writer);
1236
- return writer.toBytes();
1237
- });
1238
- this.validate = options.validate ?? (() => {
1239
- });
1240
- }
1241
- write(value, writer) {
1242
- this.validate(value);
1243
- this.#write(value, writer);
1244
- }
1245
- serialize(value, options) {
1246
- this.validate(value);
1247
- return new SerializedBcs(this, this.#serialize(value, options));
1248
- }
1249
- parse(bytes) {
1250
- const reader = new BcsReader(bytes);
1251
- return this.read(reader);
1252
- }
1253
- fromHex(hex) {
1254
- return this.parse(fromHex2(hex));
1255
- }
1256
- fromBase58(b64) {
1257
- return this.parse(fromBase58(b64));
1258
- }
1259
- fromBase64(b64) {
1260
- return this.parse(fromBase64(b64));
1261
- }
1262
- transform({ name, input, output, validate: validate6 }) {
1263
- return new BcsType2({
1264
- name: name ?? this.name,
1265
- read: (reader) => output ? output(this.read(reader)) : this.read(reader),
1266
- write: (value, writer) => this.#write(input ? input(value) : value, writer),
1267
- serializedSize: (value) => this.serializedSize(input ? input(value) : value),
1268
- serialize: (value, options) => this.#serialize(input ? input(value) : value, options),
1269
- validate: (value) => {
1270
- validate6?.(value);
1271
- this.validate(input ? input(value) : value);
1272
- }
1273
- });
1274
- }
1275
- };
1276
- var SERIALIZED_BCS_BRAND = /* @__PURE__ */ Symbol.for("@mysten/serialized-bcs");
1277
- var SerializedBcs = class {
1278
- #schema;
1279
- #bytes;
1280
- get [SERIALIZED_BCS_BRAND]() {
1281
- return true;
1282
- }
1283
- constructor(schema, bytes) {
1284
- this.#schema = schema;
1285
- this.#bytes = bytes;
1286
- }
1287
- toBytes() {
1288
- return this.#bytes;
1289
- }
1290
- toHex() {
1291
- return toHex2(this.#bytes);
1292
- }
1293
- toBase64() {
1294
- return toBase64(this.#bytes);
1295
- }
1296
- toBase58() {
1297
- return toBase58(this.#bytes);
1298
- }
1299
- parse() {
1300
- return this.#schema.parse(this.#bytes);
1301
- }
1302
- };
1303
- function fixedSizeBcsType({ size: size5, ...options }) {
1304
- return new BcsType({
1305
- ...options,
1306
- serializedSize: () => size5
1307
- });
1308
- }
1309
- function uIntBcsType({ readMethod, writeMethod, ...options }) {
1310
- return fixedSizeBcsType({
1311
- ...options,
1312
- read: (reader) => reader[readMethod](),
1313
- write: (value, writer) => writer[writeMethod](value),
1314
- validate: (value) => {
1315
- if (value < 0 || value > options.maxValue) throw new TypeError(`Invalid ${options.name} value: ${value}. Expected value in range 0-${options.maxValue}`);
1316
- options.validate?.(value);
1317
- }
1318
- });
1319
- }
1320
- function bigUIntBcsType({ readMethod, writeMethod, ...options }) {
1321
- return fixedSizeBcsType({
1322
- ...options,
1323
- read: (reader) => reader[readMethod](),
1324
- write: (value, writer) => writer[writeMethod](BigInt(value)),
1325
- validate: (val) => {
1326
- const value = BigInt(val);
1327
- if (value < 0 || value > options.maxValue) throw new TypeError(`Invalid ${options.name} value: ${value}. Expected value in range 0-${options.maxValue}`);
1328
- options.validate?.(value);
1329
- }
1330
- });
1331
- }
1332
- function dynamicSizeBcsType({ serialize, ...options }) {
1333
- const type = new BcsType({
1334
- ...options,
1335
- serialize,
1336
- write: (value, writer) => {
1337
- for (const byte of type.serialize(value).toBytes()) writer.write8(byte);
1338
- }
1339
- });
1340
- return type;
1341
- }
1342
- function stringLikeBcsType({ toBytes: toBytes3, fromBytes: fromBytes4, ...options }) {
1343
- return new BcsType({
1344
- ...options,
1345
- read: (reader) => {
1346
- const length = reader.readULEB();
1347
- return fromBytes4(reader.readBytes(length));
1348
- },
1349
- write: (hex, writer) => {
1350
- const bytes = toBytes3(hex);
1351
- writer.writeULEB(bytes.length);
1352
- for (let i = 0; i < bytes.length; i++) writer.write8(bytes[i]);
1353
- },
1354
- serialize: (value) => {
1355
- const bytes = toBytes3(value);
1356
- const size5 = ulebEncode(bytes.length);
1357
- const result2 = new Uint8Array(size5.length + bytes.length);
1358
- result2.set(size5, 0);
1359
- result2.set(bytes, size5.length);
1360
- return result2;
1361
- },
1362
- validate: (value) => {
1363
- if (typeof value !== "string") throw new TypeError(`Invalid ${options.name} value: ${value}. Expected string`);
1364
- options.validate?.(value);
1365
- }
1366
- });
1367
- }
1368
- function lazyBcsType(cb) {
1369
- let lazyType = null;
1370
- function getType() {
1371
- if (!lazyType) lazyType = cb();
1372
- return lazyType;
1373
- }
1374
- return new BcsType({
1375
- name: "lazy",
1376
- read: (data) => getType().read(data),
1377
- serializedSize: (value) => getType().serializedSize(value),
1378
- write: (value, writer) => getType().write(value, writer),
1379
- serialize: (value, options) => getType().serialize(value, options).toBytes()
1380
- });
1381
- }
1382
- var BcsStruct = class extends BcsType {
1383
- constructor({ name, fields, ...options }) {
1384
- const canonicalOrder = Object.entries(fields);
1385
- super({
1386
- name,
1387
- serializedSize: (values) => {
1388
- let total = 0;
1389
- for (const [field, type] of canonicalOrder) {
1390
- const size5 = type.serializedSize(values[field]);
1391
- if (size5 == null) return null;
1392
- total += size5;
1393
- }
1394
- return total;
1395
- },
1396
- read: (reader) => {
1397
- const result2 = {};
1398
- for (const [field, type] of canonicalOrder) result2[field] = type.read(reader);
1399
- return result2;
1400
- },
1401
- write: (value, writer) => {
1402
- for (const [field, type] of canonicalOrder) type.write(value[field], writer);
1403
- },
1404
- ...options,
1405
- validate: (value) => {
1406
- options?.validate?.(value);
1407
- if (typeof value !== "object" || value == null) throw new TypeError(`Expected object, found ${typeof value}`);
1408
- }
1409
- });
1410
- }
1411
- };
1412
- var BcsEnum = class extends BcsType {
1413
- constructor({ fields, ...options }) {
1414
- const canonicalOrder = Object.entries(fields);
1415
- super({
1416
- read: (reader) => {
1417
- const index2 = reader.readULEB();
1418
- const enumEntry = canonicalOrder[index2];
1419
- if (!enumEntry) throw new TypeError(`Unknown value ${index2} for enum ${options.name}`);
1420
- const [kind, type] = enumEntry;
1421
- return {
1422
- [kind]: type?.read(reader) ?? true,
1423
- $kind: kind
1424
- };
1425
- },
1426
- write: (value, writer) => {
1427
- const [name, val] = Object.entries(value).filter(([name$1]) => Object.hasOwn(fields, name$1))[0];
1428
- for (let i = 0; i < canonicalOrder.length; i++) {
1429
- const [optionName2, optionType] = canonicalOrder[i];
1430
- if (optionName2 === name) {
1431
- writer.writeULEB(i);
1432
- optionType?.write(val, writer);
1433
- return;
1434
- }
1435
- }
1436
- },
1437
- ...options,
1438
- validate: (value) => {
1439
- options?.validate?.(value);
1440
- if (typeof value !== "object" || value == null) throw new TypeError(`Expected object, found ${typeof value}`);
1441
- const keys = Object.keys(value).filter((k) => value[k] !== void 0 && Object.hasOwn(fields, k));
1442
- if (keys.length !== 1) throw new TypeError(`Expected object with one key, but found ${keys.length} for type ${options.name}}`);
1443
- const [variant] = keys;
1444
- if (!Object.hasOwn(fields, variant)) throw new TypeError(`Invalid enum variant ${variant}`);
1445
- }
1446
- });
1447
- }
1448
- };
1449
- var BcsTuple = class extends BcsType {
1450
- constructor({ fields, name, ...options }) {
1451
- super({
1452
- name: name ?? `(${fields.map((t) => t.name).join(", ")})`,
1453
- serializedSize: (values) => {
1454
- let total = 0;
1455
- for (let i = 0; i < fields.length; i++) {
1456
- const size5 = fields[i].serializedSize(values[i]);
1457
- if (size5 == null) return null;
1458
- total += size5;
1459
- }
1460
- return total;
1461
- },
1462
- read: (reader) => {
1463
- const result2 = [];
1464
- for (const field of fields) result2.push(field.read(reader));
1465
- return result2;
1466
- },
1467
- write: (value, writer) => {
1468
- for (let i = 0; i < fields.length; i++) fields[i].write(value[i], writer);
1469
- },
1470
- ...options,
1471
- validate: (value) => {
1472
- options?.validate?.(value);
1473
- if (!Array.isArray(value)) throw new TypeError(`Expected array, found ${typeof value}`);
1474
- if (value.length !== fields.length) throw new TypeError(`Expected array of length ${fields.length}, found ${value.length}`);
1475
- }
1476
- });
1477
- }
1478
- };
1479
-
1480
- // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/bcs.mjs
1481
- function fixedArray(size5, type, options) {
1482
- return new BcsType({
1483
- read: (reader) => {
1484
- const result2 = new Array(size5);
1485
- for (let i = 0; i < size5; i++) result2[i] = type.read(reader);
1486
- return result2;
1487
- },
1488
- write: (value, writer) => {
1489
- for (const item of value) type.write(item, writer);
1490
- },
1491
- ...options,
1492
- name: options?.name ?? `${type.name}[${size5}]`,
1493
- validate: (value) => {
1494
- options?.validate?.(value);
1495
- if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
1496
- if (value.length !== size5) throw new TypeError(`Expected array of length ${size5}, found ${value.length}`);
1497
- }
1498
- });
1499
- }
1500
- function option(type) {
1501
- return bcs.enum(`Option<${type.name}>`, {
1502
- None: null,
1503
- Some: type
1504
- }).transform({
1505
- input: (value) => {
1506
- if (value == null) return { None: true };
1507
- return { Some: value };
1508
- },
1509
- output: (value) => {
1510
- if (value.$kind === "Some") return value.Some;
1511
- return null;
1512
- }
1513
- });
1514
- }
1515
- function vector(type, options) {
1516
- return new BcsType({
1517
- read: (reader) => {
1518
- const length = reader.readULEB();
1519
- const result2 = new Array(length);
1520
- for (let i = 0; i < length; i++) result2[i] = type.read(reader);
1521
- return result2;
1522
- },
1523
- write: (value, writer) => {
1524
- writer.writeULEB(value.length);
1525
- for (const item of value) type.write(item, writer);
1526
- },
1527
- ...options,
1528
- name: options?.name ?? `vector<${type.name}>`,
1529
- validate: (value) => {
1530
- options?.validate?.(value);
1531
- if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
1532
- }
1533
- });
1534
- }
1535
- function compareBcsBytes(a, b) {
1536
- for (let i = 0; i < Math.min(a.length, b.length); i++) if (a[i] !== b[i]) return a[i] - b[i];
1537
- return a.length - b.length;
1538
- }
1539
- function map(keyType, valueType) {
1540
- return new BcsType({
1541
- name: `Map<${keyType.name}, ${valueType.name}>`,
1542
- read: (reader) => {
1543
- const length = reader.readULEB();
1544
- const result2 = /* @__PURE__ */ new Map();
1545
- for (let i = 0; i < length; i++) result2.set(keyType.read(reader), valueType.read(reader));
1546
- return result2;
1547
- },
1548
- write: (value, writer) => {
1549
- const entries = [...value.entries()].map(([key, val]) => [keyType.serialize(key).toBytes(), val]);
1550
- entries.sort(([a], [b]) => compareBcsBytes(a, b));
1551
- writer.writeULEB(entries.length);
1552
- for (const [keyBytes, val] of entries) {
1553
- writer.writeBytes(keyBytes);
1554
- valueType.write(val, writer);
1555
- }
1556
- }
1557
- });
1558
- }
1559
- var bcs = {
1560
- u8(options) {
1561
- return uIntBcsType({
1562
- readMethod: "read8",
1563
- writeMethod: "write8",
1564
- size: 1,
1565
- maxValue: 2 ** 8 - 1,
1566
- ...options,
1567
- name: options?.name ?? "u8"
1568
- });
1569
- },
1570
- u16(options) {
1571
- return uIntBcsType({
1572
- readMethod: "read16",
1573
- writeMethod: "write16",
1574
- size: 2,
1575
- maxValue: 2 ** 16 - 1,
1576
- ...options,
1577
- name: options?.name ?? "u16"
1578
- });
1579
- },
1580
- u32(options) {
1581
- return uIntBcsType({
1582
- readMethod: "read32",
1583
- writeMethod: "write32",
1584
- size: 4,
1585
- maxValue: 2 ** 32 - 1,
1586
- ...options,
1587
- name: options?.name ?? "u32"
1588
- });
1589
- },
1590
- u64(options) {
1591
- return bigUIntBcsType({
1592
- readMethod: "read64",
1593
- writeMethod: "write64",
1594
- size: 8,
1595
- maxValue: 2n ** 64n - 1n,
1596
- ...options,
1597
- name: options?.name ?? "u64"
1598
- });
1599
- },
1600
- u128(options) {
1601
- return bigUIntBcsType({
1602
- readMethod: "read128",
1603
- writeMethod: "write128",
1604
- size: 16,
1605
- maxValue: 2n ** 128n - 1n,
1606
- ...options,
1607
- name: options?.name ?? "u128"
1608
- });
1609
- },
1610
- u256(options) {
1611
- return bigUIntBcsType({
1612
- readMethod: "read256",
1613
- writeMethod: "write256",
1614
- size: 32,
1615
- maxValue: 2n ** 256n - 1n,
1616
- ...options,
1617
- name: options?.name ?? "u256"
1618
- });
1619
- },
1620
- bool(options) {
1621
- return fixedSizeBcsType({
1622
- size: 1,
1623
- read: (reader) => reader.read8() === 1,
1624
- write: (value, writer) => writer.write8(value ? 1 : 0),
1625
- ...options,
1626
- name: options?.name ?? "bool",
1627
- validate: (value) => {
1628
- options?.validate?.(value);
1629
- if (typeof value !== "boolean") throw new TypeError(`Expected boolean, found ${typeof value}`);
1630
- }
1631
- });
1632
- },
1633
- uleb128(options) {
1634
- return dynamicSizeBcsType({
1635
- read: (reader) => reader.readULEB(),
1636
- serialize: (value) => {
1637
- return Uint8Array.from(ulebEncode(value));
1638
- },
1639
- ...options,
1640
- name: options?.name ?? "uleb128"
1641
- });
1642
- },
1643
- bytes(size5, options) {
1644
- return fixedSizeBcsType({
1645
- size: size5,
1646
- read: (reader) => reader.readBytes(size5),
1647
- write: (value, writer) => {
1648
- writer.writeBytes(new Uint8Array(value));
1649
- },
1650
- ...options,
1651
- name: options?.name ?? `bytes[${size5}]`,
1652
- validate: (value) => {
1653
- options?.validate?.(value);
1654
- if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
1655
- if (value.length !== size5) throw new TypeError(`Expected array of length ${size5}, found ${value.length}`);
1656
- }
1657
- });
1658
- },
1659
- byteVector(options) {
1660
- return new BcsType({
1661
- read: (reader) => {
1662
- const length = reader.readULEB();
1663
- return reader.readBytes(length);
1664
- },
1665
- write: (value, writer) => {
1666
- const array = new Uint8Array(value);
1667
- writer.writeULEB(array.length);
1668
- writer.writeBytes(array);
1669
- },
1670
- ...options,
1671
- name: options?.name ?? "vector<u8>",
1672
- serializedSize: (value) => {
1673
- const length = "length" in value ? value.length : null;
1674
- return length == null ? null : ulebEncode(length).length + length;
1675
- },
1676
- validate: (value) => {
1677
- options?.validate?.(value);
1678
- if (!value || typeof value !== "object" || !("length" in value)) throw new TypeError(`Expected array, found ${typeof value}`);
1679
- }
1680
- });
1681
- },
1682
- string(options) {
1683
- return stringLikeBcsType({
1684
- toBytes: (value) => new TextEncoder().encode(value),
1685
- fromBytes: (bytes) => new TextDecoder().decode(bytes),
1686
- ...options,
1687
- name: options?.name ?? "string"
1688
- });
1689
- },
1690
- fixedArray,
1691
- option,
1692
- vector,
1693
- tuple(fields, options) {
1694
- return new BcsTuple({
1695
- fields,
1696
- ...options
1697
- });
1698
- },
1699
- struct(name, fields, options) {
1700
- return new BcsStruct({
1701
- name,
1702
- fields,
1703
- ...options
1704
- });
1705
- },
1706
- enum(name, fields, options) {
1707
- return new BcsEnum({
1708
- name,
1709
- fields,
1710
- ...options
1711
- });
1712
- },
1713
- map,
1714
- lazy(cb) {
1715
- return lazyBcsType(cb);
1716
- }
1717
- };
1718
-
1719
- // ../../packages/fast-schema/dist/index.js
1720
- import { Schema as Schema10 } from "effect";
1721
- import { Schema as Schema13 } from "effect";
1722
- import { Schema as Schema12 } from "effect";
1723
- import { Schema as Schema11 } from "effect";
1724
- import { Schema as Schema14 } from "effect";
1725
- import { Schema as Schema15 } from "effect";
1726
- import { Schema as Schema16 } from "effect";
1727
- import { Schema as Schema17 } from "effect";
1728
- import { Schema as Schema18 } from "effect";
1729
- var __defProp = Object.defineProperty;
1730
- var __export2 = (target, all) => {
1731
- for (var name in all)
1732
- __defProp(target, name, { get: all[name], enumerable: true });
1733
- };
1734
- var Uint8ArrayFromNumberArray = Schema.transform(Schema.Array(Schema.Number), Schema.Uint8ArrayFromSelf, {
1735
- strict: true,
1736
- decode: (arr) => new Uint8Array(arr),
1737
- encode: (buf) => Array.from(buf)
1738
- });
1739
- var Uint8ArrayFromBase64 = Schema.Uint8ArrayFromBase64;
1740
- var Uint8ArrayFromHex = Schema.Uint8ArrayFromHex;
1741
- var Strip0xHex = Schema.transform(Schema.String, Schema.String, {
1742
- strict: true,
1743
- decode: (s) => s.startsWith("0x") || s.startsWith("0X") ? s.slice(2) : s,
1744
- encode: (s) => s
1745
- });
1746
- var Uint8ArrayFromHexOptional0x = Schema.compose(Strip0xHex, Uint8ArrayFromHex);
1747
- var Uint8ArrayFromBech32m = (hrp) => Schema.transformOrFail(Schema.String, Schema.Uint8ArrayFromSelf, {
1748
- strict: true,
1749
- decode: (encoded, _options, ast) => {
1750
- let result2;
1751
- try {
1752
- result2 = bech32m.decode(encoded);
1753
- } catch (e) {
1754
- const error = e instanceof Error ? e.message : String(e);
1755
- const message2 = `Failed to decode bech32m: ${error}`;
1756
- const failure = new ParseResult.Type(ast, encoded, message2);
1757
- return ParseResult.fail(failure);
1758
- }
1759
- const prefix = result2.prefix;
1760
- const words = result2.words;
1761
- if (prefix !== hrp) {
1762
- const message2 = `Expected bech32m prefix "${hrp}", got "${prefix}"`;
1763
- const failure = new ParseResult.Type(ast, encoded, message2);
1764
- return ParseResult.fail(failure);
1765
- }
1766
- const array = new Uint8Array(bech32m.fromWords(words));
1767
- return ParseResult.succeed(array);
1768
- },
1769
- encode: (data, _options, ast) => {
1770
- let words;
1771
- try {
1772
- words = bech32m.toWords(data);
1773
- } catch (e) {
1774
- const error = e instanceof Error ? e.message : String(e);
1775
- const message2 = `Failed to encode bech32m: ${error}`;
1776
- const inner = new ParseResult.Type(ast, data, message2);
1777
- const failure = new ParseResult.Transformation(ast, data, "Transformation", inner);
1778
- return ParseResult.fail(failure);
1779
- }
1780
- return ParseResult.succeed(bech32m.encode(hrp, words));
1781
- }
1782
- });
1783
- var FixedUint8Array = (n) => Schema.Uint8ArrayFromSelf.pipe(
1784
- Schema.filter((a) => a.length === n, {
1785
- message: () => `Expected exactly ${n} bytes`
1786
- }),
1787
- Schema.brand(`Uint8Array${n}`)
1788
- );
1789
- var FixedUint8ArrayFromNumberArray = (n) => Schema.compose(Uint8ArrayFromNumberArray, FixedUint8Array(n));
1790
- var FixedUint8ArrayFromHex = (n) => Schema.compose(Uint8ArrayFromHex, FixedUint8Array(n));
1791
- var FixedUint8ArrayFromHexOptional0x = (n) => Schema.compose(Uint8ArrayFromHexOptional0x, FixedUint8Array(n));
1792
- var DecimalBigInt = Schema2.BigInt;
1793
- var HexBigInt = Schema2.transform(Schema2.String, Schema2.BigIntFromSelf, {
1794
- strict: true,
1795
- decode: (s) => {
1796
- const sign2 = s[0] === "-" ? -1n : 1n;
1797
- const digits = s[0] === "-" ? s.slice(1) : s;
1798
- if (digits.length === 0 || !/^[0-9a-fA-F]+$/.test(digits)) {
1799
- throw new Error(`Invalid hex string: "${s}"`);
1800
- }
1801
- return sign2 * BigInt(`0x${digits}`);
1802
- },
1803
- encode: (n) => n.toString(16)
1804
- });
1805
- var DecimalNumber = Schema2.NumberFromString;
1806
- var HexNumber = Schema2.transform(Schema2.String, Schema2.Number, {
1807
- strict: true,
1808
- decode: (s) => {
1809
- if (s.length === 0 || !/^[0-9a-fA-F]+$/.test(s)) {
1810
- throw new Error(`Invalid hex string: "${s}"`);
1811
- }
1812
- return Number(`0x${s}`);
1813
- },
1814
- encode: (n) => n.toString(16)
1815
- });
1816
- var BigIntFromNumberOrStringOrSelf = Schema2.transform(
1817
- Schema2.Union(Schema2.Number, Schema2.BigIntFromSelf, Schema2.String),
1818
- Schema2.BigIntFromSelf,
1819
- {
1820
- strict: true,
1821
- decode: (n) => typeof n === "bigint" ? n : BigInt(n),
1822
- encode: (n) => n
1823
- }
1824
- );
1825
- var UintNumber = (bits) => Schema2.Number.pipe(Schema2.int(), Schema2.between(0, 2 ** bits - 1), Schema2.brand(`Uint${bits}`));
1826
- var IntNumber = (bits) => Schema2.Number.pipe(Schema2.int(), Schema2.between(-(2 ** (bits - 1)), 2 ** (bits - 1) - 1), Schema2.brand(`Int${bits}`));
1827
- var UintBigInt = (bits) => Schema2.BigIntFromSelf.pipe(Schema2.betweenBigInt(0n, 2n ** BigInt(bits) - 1n), Schema2.brand(`Uint${bits}`));
1828
- var IntBigInt = (bits) => Schema2.BigIntFromSelf.pipe(Schema2.betweenBigInt(-(2n ** BigInt(bits - 1)), 2n ** BigInt(bits - 1) - 1n), Schema2.brand(`Int${bits}`));
1829
- var HexUintBigInt = (bits) => Schema2.compose(HexBigInt, UintBigInt(bits));
1830
- var HexIntBigInt = (bits) => Schema2.compose(HexBigInt, IntBigInt(bits));
1831
- var DecimalUintBigInt = (bits) => Schema2.compose(DecimalBigInt, UintBigInt(bits));
1832
- var DecimalIntBigInt = (bits) => Schema2.compose(DecimalBigInt, IntBigInt(bits));
1833
- var UintBigIntFromNumberOrStringOrSelf = (bits) => Schema2.compose(BigIntFromNumberOrStringOrSelf, UintBigInt(bits));
1834
- var IntBigIntFromNumberOrStringOrSelf = (bits) => Schema2.compose(BigIntFromNumberOrStringOrSelf, IntBigInt(bits));
1835
- var Uint8Array32 = FixedUint8Array(32);
1836
- var Uint8Array64 = FixedUint8Array(64);
1837
- var Uint8Array32FromNumberArray = FixedUint8ArrayFromNumberArray(32);
1838
- var Uint8Array32FromHex = FixedUint8ArrayFromHex(32);
1839
- var Uint8Array32FromHex0x = FixedUint8ArrayFromHexOptional0x(32);
1840
- var Uint8Array64FromNumberArray = FixedUint8ArrayFromNumberArray(64);
1841
- var Uint8Array64FromHex0x = FixedUint8ArrayFromHexOptional0x(64);
1842
- var Uint8Array64FromHex = FixedUint8ArrayFromHex(64);
1843
- var Uint8 = UintNumber(8);
1844
- var Uint16 = UintNumber(16);
1845
- var Uint32 = UintNumber(32);
1846
- var Int32 = IntNumber(32);
1847
- var Uint64 = UintBigInt(64);
1848
- var Int64 = IntBigInt(64);
1849
- var Uint128 = UintBigInt(128);
1850
- var Uint256 = UintBigInt(256);
1851
- var Int320 = IntBigInt(320);
1852
- var HexUint64 = HexUintBigInt(64);
1853
- var HexUint256 = HexUintBigInt(256);
1854
- var HexInt320 = HexIntBigInt(320);
1855
- var DecimalUint64 = DecimalUintBigInt(64);
1856
- var DecimalUint256 = DecimalUintBigInt(256);
1857
- var DecimalInt320 = DecimalIntBigInt(320);
1858
- var Uint64FromNumberOrStringOrSelf = UintBigIntFromNumberOrStringOrSelf(64);
1859
- var Uint256FromNumberOrStringOrSelf = UintBigIntFromNumberOrStringOrSelf(256);
1860
- var Int320FromNumberOrStringOrSelf = IntBigIntFromNumberOrStringOrSelf(320);
1861
- var CamelCaseStruct = (fields) => {
1862
- const structFields = {};
1863
- for (const key of Object.keys(fields)) {
1864
- const schema = fields[key];
1865
- const camelKey = Str.snakeToCamel(key);
1866
- if (camelKey !== key) {
1867
- structFields[camelKey] = Schema3.propertySignature(schema).pipe(Schema3.fromKey(key));
1868
- } else {
1869
- structFields[camelKey] = schema;
1870
- }
1871
- }
1872
- return Schema3.Struct(structFields);
1873
- };
1874
- var KeyedVariantSchema = Schema4.Union(Schema4.Record({ key: Schema4.String, value: Schema4.Unknown }), Schema4.String);
1875
- var TypedVariantSchema = Schema4.Struct({
1876
- type: Schema4.String,
1877
- value: Schema4.optional(Schema4.Unknown)
1878
- });
1879
- var TypedVariant = (variants, options) => {
1880
- const bcsMode = options?.unitEncoding === "bcs";
1881
- const fail = (ast, actual, message2) => ParseResult2.fail(new ParseResult2.Type(ast, actual, message2));
1882
- return Schema4.transformOrFail(KeyedVariantSchema, TypedVariantSchema, {
1883
- strict: false,
1884
- decode: (kv, _options, ast) => {
1885
- if (typeof kv === "string") {
1886
- if (!(kv in variants)) return fail(ast, kv, `Unknown variant "${kv}"`);
1887
- if (variants[kv] !== null) return fail(ast, kv, `Variant "${kv}" expects data`);
1888
- return ParseResult2.succeed({ type: kv });
1889
- }
1890
- const keys = Object.keys(kv);
1891
- if (keys.length !== 1) {
1892
- return fail(ast, kv, `Expected exactly one key, got ${keys.length}`);
1893
- }
1894
- const type = keys[0];
1895
- if (!(type in variants)) return fail(ast, kv, `Unknown variant "${type}"`);
1896
- const schema = variants[type];
1897
- if (schema === null || schema === void 0) {
1898
- return ParseResult2.succeed({ type });
1899
- }
1900
- const decoded = ParseResult2.decodeUnknownEither(schema)(kv[type]);
1901
- if (Either.isLeft(decoded)) return ParseResult2.fail(decoded.left);
1902
- return ParseResult2.succeed({ type, value: decoded.right });
1903
- },
1904
- encode: (tv, _options, ast) => {
1905
- const { type, value } = tv;
1906
- if (!(type in variants)) return fail(ast, tv, `Unknown variant "${type}"`);
1907
- const schema = variants[type];
1908
- if (schema === null || schema === void 0) {
1909
- return ParseResult2.succeed(bcsMode ? { [type]: [] } : type);
1910
- }
1911
- const encoded = ParseResult2.encodeUnknownEither(schema)(value);
1912
- if (Either.isLeft(encoded)) return ParseResult2.fail(encoded.left);
1913
- return ParseResult2.succeed({ [type]: encoded.right });
1914
- }
1915
- });
1916
- };
1917
- var Amount = Uint256.pipe(Schema5.brand("Amount"));
1918
- var Balance = Int320.pipe(Schema5.brand("Balance"));
1919
- var Nonce = Uint64.pipe(Schema5.brand("Nonce"));
1920
- var Quorum = Uint64.pipe(Schema5.brand("Quorum"));
1921
- var NetworkId = Schema5.Literal("fast:localnet", "fast:devnet", "fast:testnet", "fast:mainnet");
1922
- var TransactionVersion = Schema5.Literal("Release20260319", "Release20260407");
1923
- var SupportedTransactionVersions = TransactionVersion.literals;
1924
- var LatestTransactionVersion = "Release20260407";
1925
- var Address = Uint8Array32.pipe(Schema5.brand("Address"));
1926
- var Signature = Uint8Array64.pipe(Schema5.brand("Signature"));
1927
- var TokenId = Uint8Array32.pipe(Schema5.brand("TokenId"));
1928
- var StateKey = Uint8Array32.pipe(Schema5.brand("StateKey"));
1929
- var State = Uint8Array32.pipe(Schema5.brand("State"));
1930
- var ClaimData = Schema5.Uint8ArrayFromSelf.pipe(Schema5.brand("ClaimData"));
1931
- var UserData = Schema5.NullOr(Uint8Array32.pipe(Schema5.brand("UserData")));
1932
- var AmountFromBcs = Uint256FromNumberOrStringOrSelf.pipe(Schema6.brand("Amount"));
1933
- var BalanceFromBcs = Int320FromNumberOrStringOrSelf.pipe(Schema6.brand("Balance"));
1934
- var NonceFromBcs = Uint64FromNumberOrStringOrSelf.pipe(Schema6.brand("Nonce"));
1935
- var QuorumFromBcs = Uint64FromNumberOrStringOrSelf.pipe(Schema6.brand("Quorum"));
1936
- var NetworkIdFromBcs = NetworkId;
1937
- var AddressFromBcs = Uint8Array32FromNumberArray.pipe(Schema6.brand("Address"));
1938
- var SignatureFromBcs = Uint8Array64FromNumberArray.pipe(Schema6.brand("Signature"));
1939
- var TokenIdFromBcs = Uint8Array32FromNumberArray.pipe(Schema6.brand("TokenId"));
1940
- var StateKeyFromBcs = Uint8Array32FromNumberArray.pipe(Schema6.brand("StateKey"));
1941
- var StateFromBcs = Uint8Array32FromNumberArray.pipe(Schema6.brand("State"));
1942
- var ClaimDataFromBcs = Uint8ArrayFromNumberArray.pipe(Schema6.brand("ClaimData"));
1943
- var UserDataFromBcs = Schema6.NullOr(Uint8Array32FromNumberArray.pipe(Schema6.brand("UserData")));
1944
- var AmountFromInput = Schema7.Union(Uint256FromNumberOrStringOrSelf, HexUint256, DecimalUint256).pipe(Schema7.brand("Amount"));
1945
- var BalanceFromInput = Schema7.Union(Int320FromNumberOrStringOrSelf, HexInt320, DecimalInt320).pipe(Schema7.brand("Balance"));
1946
- var NonceFromInput = Uint64FromNumberOrStringOrSelf.pipe(Schema7.brand("Nonce"));
1947
- var QuorumFromInput = Uint64FromNumberOrStringOrSelf.pipe(Schema7.brand("Quorum"));
1948
- var NetworkIdFromInput = NetworkId;
1949
- var AddressFromInput = Schema7.Union(
1950
- Uint8Array32,
1951
- Uint8Array32FromNumberArray,
1952
- Uint8Array32FromHex0x,
1953
- Schema7.compose(Uint8ArrayFromBech32m("fast"), Uint8Array32)
1954
- ).pipe(Schema7.brand("Address"));
1955
- var SignatureFromInput = Schema7.Union(Uint8Array64, Uint8Array64FromNumberArray, Uint8Array64FromHex0x).pipe(Schema7.brand("Signature"));
1956
- var TokenIdFromInput = Schema7.Union(Uint8Array32, Uint8Array32FromNumberArray, Uint8Array32FromHex0x).pipe(Schema7.brand("TokenId"));
1957
- var StateKeyFromInput = Schema7.Union(Uint8Array32, Uint8Array32FromNumberArray, Uint8Array32FromHex0x).pipe(Schema7.brand("StateKey"));
1958
- var StateFromInput = Schema7.Union(Uint8Array32, Uint8Array32FromNumberArray, Uint8Array32FromHex0x).pipe(Schema7.brand("State"));
1959
- var ClaimDataFromInput = Schema7.Union(Schema7.Uint8ArrayFromSelf, Uint8ArrayFromNumberArray, Uint8ArrayFromHexOptional0x).pipe(
1960
- Schema7.brand("ClaimData")
1961
- );
1962
- var UserDataFromInput = Schema7.NullOr(
1963
- Schema7.Union(Uint8Array32, Uint8Array32FromNumberArray, Uint8Array32FromHex0x).pipe(Schema7.brand("UserData"))
1964
- );
1965
- var AmountFromRest = DecimalUint256.pipe(Schema8.brand("Amount"));
1966
- var BalanceFromRest = DecimalInt320.pipe(Schema8.brand("Balance"));
1967
- var NonceFromRest = Uint64FromNumberOrStringOrSelf.pipe(Schema8.brand("Nonce"));
1968
- var QuorumFromRest = Uint64FromNumberOrStringOrSelf.pipe(Schema8.brand("Quorum"));
1969
- var NetworkIdFromRest = NetworkId;
1970
- var AddressFromRest = Schema8.compose(Uint8ArrayFromBech32m("fast"), Uint8Array32).pipe(Schema8.brand("Address"));
1971
- var SignatureFromRest = Uint8Array64FromHex.pipe(Schema8.brand("Signature"));
1972
- var TokenIdFromRest = Uint8Array32FromHex.pipe(Schema8.brand("TokenId"));
1973
- var StateKeyFromRest = Uint8Array32FromHex.pipe(Schema8.brand("StateKey"));
1974
- var StateFromRest = Uint8Array32FromHex.pipe(Schema8.brand("State"));
1975
- var ClaimDataFromRest = Schema8.Uint8ArrayFromHex.pipe(Schema8.brand("ClaimData"));
1976
- var UserDataFromRest = Schema8.NullOr(Uint8Array32FromHex.pipe(Schema8.brand("UserData")));
1977
- var AmountFromRpc = HexUint256.pipe(Schema9.brand("Amount"));
1978
- var BalanceFromRpc = HexInt320.pipe(Schema9.brand("Balance"));
1979
- var NonceFromRpc = Uint64FromNumberOrStringOrSelf.pipe(Schema9.brand("Nonce"));
1980
- var QuorumFromRpc = Uint64FromNumberOrStringOrSelf.pipe(Schema9.brand("Quorum"));
1981
- var NetworkIdFromRpc = NetworkId;
1982
- var AddressFromRpc = Uint8Array32FromNumberArray.pipe(Schema9.brand("Address"));
1983
- var SignatureFromRpc = Uint8Array64FromNumberArray.pipe(Schema9.brand("Signature"));
1984
- var TokenIdFromRpc = Uint8Array32FromNumberArray.pipe(Schema9.brand("TokenId"));
1985
- var StateKeyFromRpc = Uint8Array32FromNumberArray.pipe(Schema9.brand("StateKey"));
1986
- var StateFromRpc = Uint8Array32FromNumberArray.pipe(Schema9.brand("State"));
1987
- var ClaimDataFromRpc = Uint8ArrayFromNumberArray.pipe(Schema9.brand("ClaimData"));
1988
- var UserDataFromRpc = Schema9.NullOr(Uint8Array32FromNumberArray.pipe(Schema9.brand("UserData")));
1989
- var bcs_layout_exports = {};
1990
- __export2(bcs_layout_exports, {
1991
- AddressChange: () => AddressChange,
1992
- Amount: () => Amount2,
1993
- Burn: () => Burn,
1994
- ClaimData: () => ClaimData2,
1995
- ClaimType: () => ClaimType,
1996
- CommitteeChange: () => CommitteeChange,
1997
- CommitteeConfig: () => CommitteeConfig,
1998
- Escrow: () => Escrow,
1999
- EscrowComplete: () => EscrowComplete,
2000
- EscrowCreateConfig: () => EscrowCreateConfig,
2001
- EscrowCreateJob: () => EscrowCreateJob,
2002
- EscrowReject: () => EscrowReject,
2003
- EscrowSubmit: () => EscrowSubmit,
2004
- ExternalClaim: () => ExternalClaim,
2005
- ExternalClaimBody: () => ExternalClaimBody,
2006
- FixedAmountOrBps: () => FixedAmountOrBps,
2007
- Mint: () => Mint,
2008
- MultiSig: () => MultiSig,
2009
- MultiSigConfig: () => MultiSigConfig,
2010
- Nonce: () => Nonce2,
2011
- Operation: () => Operation,
2012
- PublicKeyBytes: () => PublicKeyBytes,
2013
- Quorum: () => Quorum2,
2014
- Signature: () => Signature2,
2015
- SignatureOrMultiSig: () => SignatureOrMultiSig,
2016
- State: () => State2,
2017
- StateInitialization: () => StateInitialization,
2018
- StateKey: () => StateKey2,
2019
- StateReset: () => StateReset,
2020
- StateUpdate: () => StateUpdate,
2021
- TimestampNanos: () => TimestampNanos,
2022
- TokenCreation: () => TokenCreation,
2023
- TokenDecimals: () => TokenDecimals,
2024
- TokenId: () => TokenId2,
2025
- TokenManagement: () => TokenManagement,
2026
- TokenName: () => TokenName,
2027
- TokenTransfer: () => TokenTransfer,
2028
- Transaction20260319: () => Transaction20260319,
2029
- Transaction20260407: () => Transaction20260407,
2030
- UserData: () => UserData2,
2031
- ValidatorConfig: () => ValidatorConfig,
2032
- VerifierSig: () => VerifierSig,
2033
- VersionedTransaction: () => VersionedTransaction
2034
- });
2035
- var PublicKeyBytes = bcs.fixedArray(32, bcs.u8());
2036
- var StateKey2 = bcs.fixedArray(32, bcs.u8());
2037
- var Nonce2 = bcs.u64();
2038
- var TimestampNanos = bcs.u128();
2039
- var TokenId2 = bcs.fixedArray(32, bcs.u8());
2040
- var TokenName = bcs.string();
2041
- var TokenDecimals = bcs.u8();
2042
- var Amount2 = bcs.u256();
2043
- var UserData2 = bcs.option(bcs.fixedArray(32, bcs.u8()));
2044
- var State2 = bcs.fixedArray(32, bcs.u8());
2045
- var Quorum2 = bcs.u64();
2046
- var ClaimData2 = bcs.vector(bcs.u8());
2047
- var Signature2 = bcs.fixedArray(64, bcs.u8());
2048
- var MultiSigConfig = bcs.struct("MultiSigConfig", {
2049
- authorized_signers: bcs.vector(PublicKeyBytes),
2050
- quorum: Quorum2,
2051
- nonce: Nonce2
2052
- });
2053
- var MultiSig = bcs.struct("MultiSig", {
2054
- config: MultiSigConfig,
2055
- signatures: bcs.vector(bcs.tuple([PublicKeyBytes, Signature2]))
2056
- });
2057
- var SignatureOrMultiSig = bcs.enum("SignatureOrMultiSig", {
2058
- Signature: Signature2,
2059
- MultiSig
2060
- });
2061
- var AddressChange = bcs.enum("AddressChange", {
2062
- Add: bcs.tuple([]),
2063
- Remove: bcs.tuple([])
2064
- });
2065
- var TokenTransfer = bcs.struct("TokenTransfer", {
2066
- token_id: TokenId2,
2067
- recipient: PublicKeyBytes,
2068
- amount: Amount2,
2069
- user_data: UserData2
2070
- });
2071
- var TokenCreation = bcs.struct("TokenCreation", {
2072
- token_name: TokenName,
2073
- decimals: TokenDecimals,
2074
- initial_amount: Amount2,
2075
- mints: bcs.vector(PublicKeyBytes),
2076
- user_data: UserData2
2077
- });
2078
- var TokenManagement = bcs.struct("TokenManagement", {
2079
- token_id: TokenId2,
2080
- update_id: Nonce2,
2081
- new_admin: bcs.option(PublicKeyBytes),
2082
- mints: bcs.vector(bcs.tuple([AddressChange, PublicKeyBytes])),
2083
- user_data: UserData2
2084
- });
2085
- var Mint = bcs.struct("Mint", {
2086
- token_id: TokenId2,
2087
- recipient: PublicKeyBytes,
2088
- amount: Amount2
2089
- });
2090
- var Burn = bcs.struct("Burn", {
2091
- token_id: TokenId2,
2092
- amount: Amount2
2093
- });
2094
- var StateInitialization = bcs.struct("StateInitialization", {
2095
- key: StateKey2,
2096
- initial_state: State2
2097
- });
2098
- var StateUpdate = bcs.struct("StateUpdate", {
2099
- key: StateKey2,
2100
- previous_state: State2,
2101
- next_state: State2,
2102
- compute_claim_tx_hash: bcs.fixedArray(32, bcs.u8()),
2103
- compute_claim_tx_timestamp: TimestampNanos
2104
- });
2105
- var StateReset = bcs.struct("StateReset", {
2106
- key: StateKey2,
2107
- reset_state: State2
2108
- });
2109
- var ExternalClaimBody = bcs.struct("ExternalClaimBody", {
2110
- verifier_committee: bcs.vector(PublicKeyBytes),
2111
- verifier_quorum: Quorum2,
2112
- claim_data: ClaimData2
2113
- });
2114
- var VerifierSig = bcs.struct("VerifierSig", {
2115
- verifier_addr: PublicKeyBytes,
2116
- sig: Signature2
2117
- });
2118
- var ExternalClaim = bcs.struct("ExternalClaim", {
2119
- claim: ExternalClaimBody,
2120
- signatures: bcs.vector(VerifierSig)
2121
- });
2122
- var ValidatorConfig = bcs.struct("ValidatorConfig", {
2123
- address: PublicKeyBytes,
2124
- host: bcs.string(),
2125
- rpc_port: bcs.u32()
2126
- });
2127
- var CommitteeConfig = bcs.struct("CommitteeConfig", {
2128
- validators: bcs.vector(ValidatorConfig)
2129
- });
2130
- var CommitteeChange = bcs.struct("CommitteeChange", {
2131
- new_committee: CommitteeConfig,
2132
- epoch: bcs.u32()
2133
- });
2134
- var FixedAmountOrBps = bcs.enum("FixedAmountOrBps", {
2135
- Fixed: Amount2,
2136
- Bps: bcs.u16()
2137
- });
2138
- var EscrowCreateConfig = bcs.struct("EscrowCreateConfig", {
2139
- token_id: TokenId2,
2140
- evaluator: PublicKeyBytes,
2141
- evaluation_fee: FixedAmountOrBps,
2142
- min_evaluator_fee: Amount2
2143
- });
2144
- var EscrowCreateJob = bcs.struct("EscrowCreateJob", {
2145
- config_id: bcs.fixedArray(32, bcs.u8()),
2146
- provider: PublicKeyBytes,
2147
- provider_fee: Amount2,
2148
- description: bcs.string()
2149
- });
2150
- var EscrowSubmit = bcs.struct("EscrowSubmit", {
2151
- job_id: bcs.fixedArray(32, bcs.u8()),
2152
- deliverable: bcs.fixedArray(32, bcs.u8())
2153
- });
2154
- var EscrowReject = bcs.struct("EscrowReject", {
2155
- job_id: bcs.fixedArray(32, bcs.u8())
2156
- });
2157
- var EscrowComplete = bcs.struct("EscrowComplete", {
2158
- job_id: bcs.fixedArray(32, bcs.u8())
2159
- });
2160
- var Escrow = bcs.enum("Escrow", {
2161
- CreateConfig: EscrowCreateConfig,
2162
- CreateJob: EscrowCreateJob,
2163
- Submit: EscrowSubmit,
2164
- Reject: EscrowReject,
2165
- Complete: EscrowComplete
2166
- });
2167
- var Operation = bcs.enum("Operation", {
2168
- TokenTransfer,
2169
- TokenCreation,
2170
- TokenManagement,
2171
- Mint,
2172
- Burn,
2173
- StateInitialization,
2174
- StateUpdate,
2175
- ExternalClaim,
2176
- StateReset,
2177
- JoinCommittee: ValidatorConfig,
2178
- LeaveCommittee: bcs.tuple([]),
2179
- ChangeCommittee: CommitteeChange,
2180
- Escrow
2181
- });
2182
- var ClaimType = bcs.enum("ClaimType", {
2183
- TokenTransfer,
2184
- TokenCreation,
2185
- TokenManagement,
2186
- Mint,
2187
- Burn,
2188
- StateInitialization,
2189
- StateUpdate,
2190
- ExternalClaim,
2191
- StateReset,
2192
- JoinCommittee: ValidatorConfig,
2193
- LeaveCommittee: bcs.tuple([]),
2194
- ChangeCommittee: CommitteeChange,
2195
- Escrow,
2196
- Batch: bcs.vector(Operation)
2197
- });
2198
- var Transaction20260319 = bcs.struct("Transaction", {
2199
- network_id: bcs.string(),
2200
- sender: PublicKeyBytes,
2201
- nonce: Nonce2,
2202
- timestamp_nanos: TimestampNanos,
2203
- claim: ClaimType,
2204
- archival: bcs.bool(),
2205
- fee_token: bcs.option(TokenId2)
2206
- });
2207
- var Transaction20260407 = bcs.struct("Transaction20260407", {
2208
- network_id: bcs.string(),
2209
- sender: PublicKeyBytes,
2210
- nonce: Nonce2,
2211
- timestamp_nanos: TimestampNanos,
2212
- claims: bcs.vector(Operation),
2213
- archival: bcs.bool(),
2214
- fee_token: bcs.option(TokenId2)
2215
- });
2216
- var VersionedTransaction = bcs.enum("VersionedTransaction", {
2217
- Release20260319: Transaction20260319,
2218
- Release20260407: Transaction20260407
2219
- });
2220
- var FastSetErrorData = TypedVariant({
2221
- UnexpectedNonce: CamelCaseStruct({
2222
- expected_nonce: BigIntFromNumberOrStringOrSelf
2223
- }),
2224
- InsufficientFunding: CamelCaseStruct({
2225
- current_balance: BigIntFromNumberOrStringOrSelf
2226
- }),
2227
- PreviousTransactionMustBeConfirmedFirst: CamelCaseStruct({
2228
- pending_confirmation: Schema10.Unknown
2229
- }),
2230
- InvalidSignature: Schema10.Struct({
2231
- error: Schema10.String
2232
- }),
2233
- MissingEarlierConfirmations: CamelCaseStruct({
2234
- current_nonce: BigIntFromNumberOrStringOrSelf
2235
- }),
2236
- CertificateTooYoung: CamelCaseStruct({
2237
- resend_after_nanos: BigIntFromNumberOrStringOrSelf
2238
- }),
2239
- NonSubmittableOperation: Schema10.Struct({
2240
- reason: Schema10.String
2241
- })
2242
- });
2243
- var JsonRpcError = TypedVariant({
2244
- FastSet: FastSetErrorData,
2245
- Generic: Schema10.String
2246
- });
2247
- var ProxyErrorData = TypedVariant({
2248
- GeneralError: Schema10.String,
2249
- FaucetDisabled: null,
2250
- RpcError: JsonRpcError,
2251
- FaucetThrottled: Schema10.Unknown,
2252
- FaucetTxnFailed: Schema10.Unknown,
2253
- FaucetThresholdExceeded: Schema10.Unknown,
2254
- VerifierSigsInvalid: Schema10.Unknown,
2255
- DatabaseError: Schema10.String,
2256
- TooManyCertificatesRequested: null,
2257
- UnexpectedNonce: CamelCaseStruct({
2258
- tx_nonce: BigIntFromNumberOrStringOrSelf,
2259
- expected_nonce: BigIntFromNumberOrStringOrSelf
2260
- }),
2261
- InvalidRequest: Schema10.String
2262
- });
2263
- var makeAddressChange = (options) => TypedVariant({ Add: null, Remove: null }, options);
2264
- var AddressChange2 = makeAddressChange();
2265
- var makeTokenTransfer = (p4) => CamelCaseStruct({ token_id: p4.TokenId, recipient: p4.Address, amount: p4.Amount, user_data: p4.UserData });
2266
- var makeTokenCreation = (p4) => CamelCaseStruct({
2267
- token_name: Schema11.String,
2268
- decimals: Schema11.Number,
2269
- initial_amount: p4.Amount,
2270
- mints: Schema11.Array(p4.Address),
2271
- user_data: p4.UserData
2272
- });
2273
- var makeTokenManagement = (p4, options) => CamelCaseStruct({
2274
- token_id: p4.TokenId,
2275
- update_id: p4.Nonce,
2276
- new_admin: Schema11.NullOr(p4.Address),
2277
- mints: Schema11.Array(Schema11.Tuple(makeAddressChange(options), p4.Address)),
2278
- user_data: p4.UserData
2279
- });
2280
- var makeMint = (p4) => CamelCaseStruct({ token_id: p4.TokenId, recipient: p4.Address, amount: p4.Amount });
2281
- var makeBurn = (p4) => CamelCaseStruct({ token_id: p4.TokenId, amount: p4.Amount });
2282
- var makeStateInitialization = (p4) => CamelCaseStruct({ key: p4.StateKey, initial_state: p4.State });
2283
- var makeStateUpdate = (p4) => CamelCaseStruct({
2284
- key: p4.StateKey,
2285
- previous_state: p4.State,
2286
- next_state: p4.State,
2287
- compute_claim_tx_hash: p4.StateKey,
2288
- compute_claim_tx_timestamp: p4.BigInt
2289
- });
2290
- var makeStateReset = (p4) => CamelCaseStruct({ key: p4.StateKey, reset_state: p4.State });
2291
- var makeExternalClaimBody = (p4) => CamelCaseStruct({ verifier_committee: Schema11.Array(p4.Address), verifier_quorum: p4.Quorum, claim_data: p4.ClaimData });
2292
- var makeVerifierSig = (p4) => CamelCaseStruct({ verifier_addr: p4.Address, sig: p4.Signature });
2293
- var makeExternalClaim = (p4) => Schema11.Struct({ claim: makeExternalClaimBody(p4), signatures: Schema11.Array(makeVerifierSig(p4)) });
2294
- var makeValidatorConfig = (p4) => CamelCaseStruct({ address: p4.Address, host: Schema11.String, rpc_port: Schema11.Number });
2295
- var makeCommitteeConfig = (p4) => Schema11.Struct({ validators: Schema11.Array(makeValidatorConfig(p4)) });
2296
- var makeCommitteeChange = (p4) => CamelCaseStruct({ new_committee: makeCommitteeConfig(p4), epoch: Schema11.Number });
2297
- var makeFixedAmountOrBps = (p4, options) => TypedVariant({ Fixed: p4.Amount, Bps: Schema11.Number }, options);
2298
- var makeEscrowCreateConfig = (p4, options) => CamelCaseStruct({
2299
- token_id: p4.TokenId,
2300
- evaluator: p4.Address,
2301
- evaluation_fee: makeFixedAmountOrBps(p4, options),
2302
- min_evaluator_fee: p4.Amount
2303
- });
2304
- var makeEscrowCreateJob = (p4) => CamelCaseStruct({
2305
- config_id: p4.TokenId,
2306
- provider: p4.Address,
2307
- provider_fee: p4.Amount,
2308
- description: Schema11.String
2309
- });
2310
- var makeEscrowSubmit = (p4) => CamelCaseStruct({ job_id: p4.TokenId, deliverable: p4.TokenId });
2311
- var makeEscrowReject = (p4) => CamelCaseStruct({ job_id: p4.TokenId });
2312
- var makeEscrowComplete = (p4) => CamelCaseStruct({ job_id: p4.TokenId });
2313
- var makeEscrow = (p4, options) => TypedVariant(
2314
- {
2315
- CreateConfig: makeEscrowCreateConfig(p4, options),
2316
- CreateJob: makeEscrowCreateJob(p4),
2317
- Submit: makeEscrowSubmit(p4),
2318
- Reject: makeEscrowReject(p4),
2319
- Complete: makeEscrowComplete(p4)
2320
- },
2321
- options
2322
- );
2323
- var makeOperation = (p4, options) => TypedVariant(
2324
- {
2325
- TokenTransfer: makeTokenTransfer(p4),
2326
- TokenCreation: makeTokenCreation(p4),
2327
- TokenManagement: makeTokenManagement(p4, options),
2328
- Mint: makeMint(p4),
2329
- Burn: makeBurn(p4),
2330
- StateInitialization: makeStateInitialization(p4),
2331
- StateUpdate: makeStateUpdate(p4),
2332
- StateReset: makeStateReset(p4),
2333
- ExternalClaim: makeExternalClaim(p4),
2334
- JoinCommittee: makeValidatorConfig(p4),
2335
- LeaveCommittee: null,
2336
- ChangeCommittee: makeCommitteeChange(p4),
2337
- Escrow: makeEscrow(p4, options)
2338
- },
2339
- options
2340
- );
2341
- var makeClaimType = (p4, options) => TypedVariant(
2342
- {
2343
- TokenTransfer: makeTokenTransfer(p4),
2344
- TokenCreation: makeTokenCreation(p4),
2345
- TokenManagement: makeTokenManagement(p4, options),
2346
- Mint: makeMint(p4),
2347
- Burn: makeBurn(p4),
2348
- StateInitialization: makeStateInitialization(p4),
2349
- StateUpdate: makeStateUpdate(p4),
2350
- StateReset: makeStateReset(p4),
2351
- ExternalClaim: makeExternalClaim(p4),
2352
- JoinCommittee: makeValidatorConfig(p4),
2353
- LeaveCommittee: null,
2354
- ChangeCommittee: makeCommitteeChange(p4),
2355
- Escrow: makeEscrow(p4, options),
2356
- Batch: Schema11.Array(makeOperation(p4, options))
2357
- },
2358
- options
2359
- );
2360
- var makeTransactionRelease20260319 = (p4, options) => CamelCaseStruct({
2361
- network_id: p4.NetworkId,
2362
- sender: p4.Address,
2363
- nonce: p4.Nonce,
2364
- timestamp_nanos: p4.BigInt,
2365
- claim: makeClaimType(p4, options),
2366
- archival: Schema12.Boolean,
2367
- fee_token: Schema12.NullOr(p4.TokenId)
2368
- });
2369
- var makeTransactionRelease20260407 = (p4, options) => CamelCaseStruct({
2370
- network_id: p4.NetworkId,
2371
- sender: p4.Address,
2372
- nonce: p4.Nonce,
2373
- timestamp_nanos: p4.BigInt,
2374
- claims: Schema12.Array(makeOperation(p4, options)),
2375
- archival: Schema12.Boolean,
2376
- fee_token: Schema12.NullOr(p4.TokenId)
2377
- });
2378
- var makeTransaction = makeTransactionRelease20260407;
2379
- var makeVersionedTransaction = (p4, options) => TypedVariant({
2380
- Release20260319: makeTransactionRelease20260319(p4, options),
2381
- Release20260407: makeTransactionRelease20260407(p4, options)
2382
- });
2383
- var makeMultiSigConfig = (p4) => CamelCaseStruct({ authorized_signers: Schema13.Array(p4.Address), quorum: p4.Quorum, nonce: p4.Nonce });
2384
- var makeMultiSig = (p4) => Schema13.Struct({
2385
- config: makeMultiSigConfig(p4),
2386
- signatures: Schema13.Array(Schema13.Tuple(p4.Address, p4.Signature))
2387
- });
2388
- var makeSignatureOrMultiSig = (p4) => TypedVariant({
2389
- Signature: p4.Signature,
2390
- MultiSig: makeMultiSig(p4)
2391
- });
2392
- var makeTransactionEnvelope = (p4) => Schema13.Struct({
2393
- transaction: makeVersionedTransaction(p4),
2394
- signature: makeSignatureOrMultiSig(p4)
2395
- });
2396
- var makeValidatedTransaction = (p4) => Schema13.Struct({
2397
- value: makeTransactionEnvelope(p4),
2398
- validator: p4.Address,
2399
- signature: p4.Signature
2400
- });
2401
- var makeTransactionCertificate = (p4) => Schema13.Struct({
2402
- envelope: makeTransactionEnvelope(p4),
2403
- signatures: Schema13.Array(Schema13.Tuple(p4.Address, p4.Signature))
2404
- });
2405
- var makeNonceRange = (p4) => Schema14.Struct({ start: p4.Nonce, limit: Schema14.Number });
2406
- var makePageRequest = (p4) => Schema14.Struct({ limit: Schema14.Number, token: Schema14.optional(p4.BigInt) });
2407
- var makeTokenMetadata = (p4) => CamelCaseStruct({
2408
- update_id: p4.Nonce,
2409
- admin: p4.Address,
2410
- token_name: Schema14.String,
2411
- decimals: Schema14.Number,
2412
- total_supply: p4.Amount,
2413
- mints: Schema14.Array(p4.Address)
2414
- });
2415
- var makeAccountInfoResponse = (p4) => CamelCaseStruct({
2416
- sender: p4.Address,
2417
- balance: p4.Balance,
2418
- next_nonce: p4.Nonce,
2419
- pending_confirmation: Schema14.NullOr(makeValidatedTransaction(p4)),
2420
- requested_state: Schema14.Array(Schema14.Tuple(p4.StateKey, p4.State)),
2421
- requested_certificates: Schema14.NullOr(Schema14.Array(makeTransactionCertificate(p4))),
2422
- requested_validated_transaction: Schema14.NullOr(makeValidatedTransaction(p4)),
2423
- token_balance: Schema14.Array(Schema14.Tuple(p4.TokenId, p4.Balance))
2424
- });
2425
- var makeTokenInfoResponse = (p4) => CamelCaseStruct({
2426
- requested_token_metadata: Schema14.Array(Schema14.Tuple(p4.TokenId, Schema14.NullOr(makeTokenMetadata(p4))))
2427
- });
2428
- var makeSubmitTransactionResponse = (p4) => CamelCaseStruct({ validator: p4.Address, signature: p4.Signature, next_nonce: p4.Nonce, transaction_hash: p4.ClaimData });
2429
- var makeConfirmTransactionResponse = (p4) => CamelCaseStruct({ token_ids: Schema14.Array(p4.TokenId) });
2430
- var makeProxySubmitTransactionResult = (p4) => TypedVariant({
2431
- Success: makeTransactionCertificate(p4),
2432
- IncompleteVerifierSigs: null,
2433
- IncompleteMultiSig: null
2434
- });
2435
- var makeEscrowJobRecord = (p4) => CamelCaseStruct({
2436
- job_id: p4.TokenId,
2437
- config_id: p4.TokenId,
2438
- client: p4.Address,
2439
- provider: p4.Address,
2440
- evaluator: p4.Address,
2441
- token_id: p4.TokenId,
2442
- provider_fee: p4.Amount,
2443
- evaluator_fee: p4.Amount,
2444
- description: Schema14.String,
2445
- deliverable: Schema14.NullOr(p4.TokenId),
2446
- status: Schema14.String
2447
- });
2448
- var makeEscrowJobWithCerts = (p4) => Schema14.Struct({
2449
- job: makeEscrowJobRecord(p4),
2450
- certificates: Schema14.Array(makeTransactionCertificate(p4))
2451
- });
2452
- var makeSubmitTransactionParams = (p4) => makeTransactionEnvelope(p4);
2453
- var makeFaucetDripParams = (p4) => CamelCaseStruct({
2454
- recipient: p4.Address,
2455
- amount: p4.Amount,
2456
- token_id: Schema15.NullOr(p4.TokenId)
2457
- });
2458
- var makeGetAccountInfoParams = (p4) => CamelCaseStruct({
2459
- address: p4.Address,
2460
- token_balances_filter: Schema15.NullOr(Schema15.Array(p4.TokenId)),
2461
- state_key_filter: Schema15.NullOr(Schema15.Array(p4.StateKey)),
2462
- certificate_by_nonce: Schema15.NullOr(Schema15.Struct({ start: p4.Nonce, limit: Schema15.Number }))
2463
- });
2464
- var makeGetPendingMultisigParams = (p4) => Schema15.Struct({ address: p4.Address });
2465
- var makeGetTokenInfoParams = (p4) => CamelCaseStruct({ token_ids: Schema15.Array(p4.TokenId) });
2466
- var makeGetTransactionCertificatesParams = (p4) => CamelCaseStruct({
2467
- address: p4.Address,
2468
- from_nonce: p4.Nonce,
2469
- limit: Schema15.Number
2470
- });
2471
- var FaucetDripInput = Schema15.Struct({
2472
- recipient: AddressFromInput,
2473
- amount: AmountFromInput,
2474
- tokenId: Schema15.NullOr(TokenIdFromInput)
2475
- });
2476
- var GetAccountInfoInput = Schema15.Struct({
2477
- address: AddressFromInput,
2478
- tokenBalancesFilter: Schema15.optionalWith(Schema15.NullOr(Schema15.Array(TokenIdFromInput)), { default: () => null }),
2479
- stateKeyFilter: Schema15.optionalWith(Schema15.NullOr(Schema15.Array(StateKeyFromInput)), { default: () => null }),
2480
- certificateByNonce: Schema15.optionalWith(
2481
- Schema15.NullOr(
2482
- Schema15.Struct({
2483
- start: NonceFromInput,
2484
- limit: Schema15.Number
2485
- })
2486
- ),
2487
- { default: () => null }
2488
- )
2489
- });
2490
- var GetPendingMultisigInput = Schema15.Struct({
2491
- address: AddressFromInput
2492
- });
2493
- var GetTokenInfoInput = Schema15.Struct({
2494
- tokenIds: Schema15.Array(TokenIdFromInput)
2495
- });
2496
- var GetTransactionCertificatesInput = Schema15.Struct({
2497
- address: AddressFromInput,
2498
- fromNonce: NonceFromInput,
2499
- limit: Schema15.Number
2500
- });
2501
- var GetEscrowJobInput = Schema15.Struct({
2502
- jobId: TokenIdFromInput,
2503
- certs: Schema15.optionalWith(Schema15.Boolean, { default: () => false })
2504
- });
2505
- var GetEscrowJobsInput = Schema15.Struct({
2506
- client: Schema15.optional(AddressFromInput),
2507
- provider: Schema15.optional(AddressFromInput),
2508
- evaluator: Schema15.optional(AddressFromInput),
2509
- status: Schema15.optional(Schema15.String),
2510
- certs: Schema15.optionalWith(Schema15.Boolean, { default: () => false })
2511
- });
2512
- var PrivateKeyFromInput = Schema16.Union(Uint8Array32, Uint8Array32FromHex0x, Uint8Array32FromNumberArray).pipe(Schema16.brand("PrivateKey"));
2513
- var TokenTransferInput = Schema17.Struct({
2514
- tokenId: TokenIdFromInput,
2515
- recipient: AddressFromInput,
2516
- amount: AmountFromInput,
2517
- userData: UserDataFromInput
2518
- });
2519
- var TokenCreationInput = Schema17.Struct({
2520
- tokenName: Schema17.String,
2521
- decimals: Schema17.Number,
2522
- initialAmount: AmountFromInput,
2523
- mints: Schema17.Array(AddressFromInput),
2524
- userData: UserDataFromInput
2525
- });
2526
- var TokenManagementInput = Schema17.Struct({
2527
- tokenId: TokenIdFromInput,
2528
- updateId: NonceFromInput,
2529
- newAdmin: Schema17.NullOr(AddressFromInput),
2530
- mints: Schema17.Array(
2531
- Schema17.Tuple(Schema17.Union(Schema17.Struct({ type: Schema17.Literal("Add") }), Schema17.Struct({ type: Schema17.Literal("Remove") })), AddressFromInput)
2532
- ),
2533
- userData: UserDataFromInput
2534
- });
2535
- var MintInput = Schema17.Struct({
2536
- tokenId: TokenIdFromInput,
2537
- recipient: AddressFromInput,
2538
- amount: AmountFromInput
2539
- });
2540
- var BurnInput = Schema17.Struct({
2541
- tokenId: TokenIdFromInput,
2542
- amount: AmountFromInput
2543
- });
2544
- var StateInitializationInput = Schema17.Struct({
2545
- key: StateKeyFromInput,
2546
- initialState: StateFromInput
2547
- });
2548
- var StateUpdateInput = Schema17.Struct({
2549
- key: StateKeyFromInput,
2550
- previousState: StateFromInput,
2551
- nextState: StateFromInput,
2552
- computeClaimTxHash: StateKeyFromInput,
2553
- computeClaimTxTimestamp: BigIntFromNumberOrStringOrSelf
2554
- });
2555
- var StateResetInput = Schema17.Struct({
2556
- key: StateKeyFromInput,
2557
- resetState: StateFromInput
2558
- });
2559
- var ExternalClaimInput = Schema17.Struct({
2560
- claim: Schema17.Struct({
2561
- verifierCommittee: Schema17.Array(AddressFromInput),
2562
- verifierQuorum: QuorumFromInput,
2563
- claimData: ClaimDataFromInput
2564
- }),
2565
- signatures: Schema17.Array(
2566
- Schema17.Struct({
2567
- verifierAddr: AddressFromInput,
2568
- sig: SignatureFromInput
2569
- })
2570
- )
2571
- });
2572
- var ValidatorConfigInput = Schema17.Struct({
2573
- address: AddressFromInput,
2574
- host: Schema17.String,
2575
- rpcPort: Schema17.Number
2576
- });
2577
- var CommitteeChangeInput = Schema17.Struct({
2578
- newCommittee: Schema17.Struct({
2579
- validators: Schema17.Array(ValidatorConfigInput)
2580
- }),
2581
- epoch: Schema17.Number
2582
- });
2583
- var FixedAmountOrBpsInput = Schema17.Union(
2584
- Schema17.Struct({ type: Schema17.Literal("Fixed"), value: AmountFromInput }),
2585
- Schema17.Struct({ type: Schema17.Literal("Bps"), value: Schema17.Number })
2586
- );
2587
- var EscrowCreateConfigInput = Schema17.Struct({
2588
- tokenId: TokenIdFromInput,
2589
- evaluator: AddressFromInput,
2590
- evaluationFee: FixedAmountOrBpsInput,
2591
- minEvaluatorFee: AmountFromInput
2592
- });
2593
- var EscrowCreateJobInput = Schema17.Struct({
2594
- configId: TokenIdFromInput,
2595
- provider: AddressFromInput,
2596
- providerFee: AmountFromInput,
2597
- description: Schema17.String
2598
- });
2599
- var EscrowSubmitInput = Schema17.Struct({
2600
- jobId: TokenIdFromInput,
2601
- deliverable: TokenIdFromInput
2602
- });
2603
- var EscrowRejectInput = Schema17.Struct({
2604
- jobId: TokenIdFromInput
2605
- });
2606
- var EscrowCompleteInput = Schema17.Struct({
2607
- jobId: TokenIdFromInput
2608
- });
2609
- var EscrowInput = Schema17.Union(
2610
- Schema17.Struct({ type: Schema17.Literal("CreateConfig"), value: EscrowCreateConfigInput }),
2611
- Schema17.Struct({ type: Schema17.Literal("CreateJob"), value: EscrowCreateJobInput }),
2612
- Schema17.Struct({ type: Schema17.Literal("Submit"), value: EscrowSubmitInput }),
2613
- Schema17.Struct({ type: Schema17.Literal("Reject"), value: EscrowRejectInput }),
2614
- Schema17.Struct({ type: Schema17.Literal("Complete"), value: EscrowCompleteInput })
2615
- );
2616
- var OperationInput = Schema17.Union(
2617
- Schema17.Struct({
2618
- type: Schema17.Literal("TokenTransfer"),
2619
- value: TokenTransferInput
2620
- }),
2621
- Schema17.Struct({
2622
- type: Schema17.Literal("TokenCreation"),
2623
- value: TokenCreationInput
2624
- }),
2625
- Schema17.Struct({
2626
- type: Schema17.Literal("TokenManagement"),
2627
- value: TokenManagementInput
2628
- }),
2629
- Schema17.Struct({ type: Schema17.Literal("Mint"), value: MintInput }),
2630
- Schema17.Struct({ type: Schema17.Literal("Burn"), value: BurnInput }),
2631
- Schema17.Struct({
2632
- type: Schema17.Literal("StateInitialization"),
2633
- value: StateInitializationInput
2634
- }),
2635
- Schema17.Struct({
2636
- type: Schema17.Literal("StateUpdate"),
2637
- value: StateUpdateInput
2638
- }),
2639
- Schema17.Struct({ type: Schema17.Literal("StateReset"), value: StateResetInput }),
2640
- Schema17.Struct({
2641
- type: Schema17.Literal("ExternalClaim"),
2642
- value: ExternalClaimInput
2643
- }),
2644
- Schema17.Struct({
2645
- type: Schema17.Literal("JoinCommittee"),
2646
- value: ValidatorConfigInput
2647
- }),
2648
- Schema17.Struct({ type: Schema17.Literal("LeaveCommittee") }),
2649
- Schema17.Struct({
2650
- type: Schema17.Literal("ChangeCommittee"),
2651
- value: CommitteeChangeInput
2652
- }),
2653
- Schema17.Struct({
2654
- type: Schema17.Literal("Escrow"),
2655
- value: EscrowInput
2656
- })
2657
- );
2658
- var ClaimTypeInput = Schema17.Union(
2659
- ...OperationInput.members,
2660
- Schema17.Struct({
2661
- type: Schema17.Literal("Batch"),
2662
- value: Schema17.Array(OperationInput)
2663
- })
2664
- );
2665
- var TransactionRelease20260319Input = Schema17.Struct({
2666
- networkId: NetworkIdFromInput,
2667
- sender: AddressFromInput,
2668
- nonce: NonceFromInput,
2669
- timestampNanos: BigIntFromNumberOrStringOrSelf,
2670
- claim: ClaimTypeInput,
2671
- archival: Schema17.Boolean,
2672
- feeToken: Schema17.NullOr(TokenIdFromInput)
2673
- });
2674
- var TransactionRelease20260407Input = Schema17.Struct({
2675
- networkId: NetworkIdFromInput,
2676
- sender: AddressFromInput,
2677
- nonce: NonceFromInput,
2678
- timestampNanos: BigIntFromNumberOrStringOrSelf,
2679
- claims: Schema17.Array(OperationInput),
2680
- archival: Schema17.Boolean,
2681
- feeToken: Schema17.NullOr(TokenIdFromInput)
2682
- });
2683
- var TransactionVersionRegistry = {
2684
- Release20260319: {
2685
- wrapOperations(ops) {
2686
- if (ops.length === 0) {
2687
- throw new Error("Release20260319 transactions require at least one operation");
2688
- }
2689
- const claim = ops.length === 1 ? ops[0] : { type: "Batch", value: ops };
2690
- return { claim };
2691
- },
2692
- extractOperations(decoded) {
2693
- const claim = decoded.claim;
2694
- if (claim == null) return [];
2695
- if (typeof claim === "object" && !Array.isArray(claim)) {
2696
- const rec = claim;
2697
- if ("Batch" in rec && Array.isArray(rec.Batch)) {
2698
- return rec.Batch;
2699
- }
2700
- if (rec.type === "Batch" && Array.isArray(rec.value)) {
2701
- return rec.value;
2702
- }
2703
- return [claim];
2704
- }
2705
- return [];
2706
- },
2707
- inputSchema: TransactionRelease20260319Input
2708
- },
2709
- Release20260407: {
2710
- wrapOperations(ops) {
2711
- return { claims: ops };
2712
- },
2713
- extractOperations(decoded) {
2714
- return Array.isArray(decoded.claims) ? decoded.claims : [];
2715
- },
2716
- inputSchema: TransactionRelease20260407Input
2717
- }
2718
- };
2719
- function getTransactionVersionConfig(version) {
2720
- if (!(version in TransactionVersionRegistry)) {
2721
- throw new Error(`Unknown transaction version: ${version}`);
2722
- }
2723
- return TransactionVersionRegistry[version];
2724
- }
2725
- var RpcPalette = {
2726
- Amount: AmountFromRpc,
2727
- Balance: BalanceFromRpc,
2728
- Nonce: NonceFromRpc,
2729
- Quorum: QuorumFromRpc,
2730
- NetworkId: NetworkIdFromRpc,
2731
- Address: AddressFromRpc,
2732
- Signature: SignatureFromRpc,
2733
- TokenId: TokenIdFromRpc,
2734
- StateKey: StateKeyFromRpc,
2735
- State: StateFromRpc,
2736
- ClaimData: ClaimDataFromRpc,
2737
- UserData: UserDataFromRpc,
2738
- BigInt: BigIntFromNumberOrStringOrSelf
2739
- };
2740
- var RestPalette = {
2741
- Amount: AmountFromRest,
2742
- Balance: BalanceFromRest,
2743
- Nonce: NonceFromRest,
2744
- Quorum: QuorumFromRest,
2745
- NetworkId: NetworkIdFromRest,
2746
- Address: AddressFromRest,
2747
- Signature: SignatureFromRest,
2748
- TokenId: TokenIdFromRest,
2749
- StateKey: StateKeyFromRest,
2750
- State: StateFromRest,
2751
- ClaimData: ClaimDataFromRest,
2752
- UserData: UserDataFromRest,
2753
- BigInt: BigIntFromNumberOrStringOrSelf
2754
- };
2755
- var BcsPalette = {
2756
- Amount: AmountFromBcs,
2757
- Balance: BalanceFromBcs,
2758
- Nonce: NonceFromBcs,
2759
- Quorum: QuorumFromBcs,
2760
- NetworkId: NetworkIdFromBcs,
2761
- Address: AddressFromBcs,
2762
- Signature: SignatureFromBcs,
2763
- TokenId: TokenIdFromBcs,
2764
- StateKey: StateKeyFromBcs,
2765
- State: StateFromBcs,
2766
- ClaimData: ClaimDataFromBcs,
2767
- UserData: UserDataFromBcs,
2768
- BigInt: BigIntFromNumberOrStringOrSelf
2769
- };
2770
- var p = BcsPalette;
2771
- var TokenTransferFromBcs = makeTokenTransfer(p);
2772
- var TokenCreationFromBcs = makeTokenCreation(p);
2773
- var TokenManagementFromBcs = makeTokenManagement(p);
2774
- var MintFromBcs = makeMint(p);
2775
- var BurnFromBcs = makeBurn(p);
2776
- var StateInitializationFromBcs = makeStateInitialization(p);
2777
- var StateUpdateFromBcs = makeStateUpdate(p);
2778
- var StateResetFromBcs = makeStateReset(p);
2779
- var ExternalClaimBodyFromBcs = makeExternalClaimBody(p);
2780
- var VerifierSigFromBcs = makeVerifierSig(p);
2781
- var ExternalClaimFromBcs = makeExternalClaim(p);
2782
- var ValidatorConfigFromBcs = makeValidatorConfig(p);
2783
- var CommitteeConfigFromBcs = makeCommitteeConfig(p);
2784
- var CommitteeChangeFromBcs = makeCommitteeChange(p);
2785
- var bcsOpts = { unitEncoding: "bcs" };
2786
- var FixedAmountOrBpsFromBcs = makeFixedAmountOrBps(p, bcsOpts);
2787
- var EscrowCreateConfigFromBcs = makeEscrowCreateConfig(p, bcsOpts);
2788
- var EscrowCreateJobFromBcs = makeEscrowCreateJob(p);
2789
- var EscrowSubmitFromBcs = makeEscrowSubmit(p);
2790
- var EscrowRejectFromBcs = makeEscrowReject(p);
2791
- var EscrowCompleteFromBcs = makeEscrowComplete(p);
2792
- var EscrowFromBcs = makeEscrow(p, bcsOpts);
2793
- var OperationFromBcs = makeOperation(p, bcsOpts);
2794
- var ClaimTypeFromBcs = makeClaimType(p, bcsOpts);
2795
- var TransactionRelease20260319FromBcs = makeTransactionRelease20260319(p, bcsOpts);
2796
- var TransactionRelease20260407FromBcs = makeTransactionRelease20260407(p, bcsOpts);
2797
- var TransactionFromBcs = makeTransaction(p, bcsOpts);
2798
- var VersionedTransactionFromBcs = makeVersionedTransaction(p, bcsOpts);
2799
- var MultiSigConfigFromBcs = makeMultiSigConfig(p);
2800
- var MultiSigFromBcs = makeMultiSig(p);
2801
- var SignatureOrMultiSigFromBcs = makeSignatureOrMultiSig(p);
2802
- var TransactionEnvelopeFromBcs = makeTransactionEnvelope(p);
2803
- var ValidatedTransactionFromBcs = makeValidatedTransaction(p);
2804
- var TransactionCertificateFromBcs = makeTransactionCertificate(p);
2805
- var NonceRangeFromBcs = makeNonceRange(p);
2806
- var PageRequestFromBcs = makePageRequest(p);
2807
- var TokenMetadataFromBcs = makeTokenMetadata(p);
2808
- var AccountInfoResponseFromBcs = makeAccountInfoResponse(p);
2809
- var TokenInfoResponseFromBcs = makeTokenInfoResponse(p);
2810
- var SubmitTransactionResponseFromBcs = makeSubmitTransactionResponse(p);
2811
- var ConfirmTransactionResponseFromBcs = makeConfirmTransactionResponse(p);
2812
- var ProxySubmitTransactionResultFromBcs = makeProxySubmitTransactionResult(p);
2813
- var EscrowJobRecordFromBcs = makeEscrowJobRecord(p);
2814
- var EscrowJobWithCertsFromBcs = makeEscrowJobWithCerts(p);
2815
- var p2 = RestPalette;
2816
- var TokenTransferFromRest = makeTokenTransfer(p2);
2817
- var TokenCreationFromRest = makeTokenCreation(p2);
2818
- var TokenManagementFromRest = makeTokenManagement(p2);
2819
- var MintFromRest = makeMint(p2);
2820
- var BurnFromRest = makeBurn(p2);
2821
- var StateInitializationFromRest = makeStateInitialization(p2);
2822
- var StateUpdateFromRest = makeStateUpdate(p2);
2823
- var StateResetFromRest = makeStateReset(p2);
2824
- var ExternalClaimBodyFromRest = makeExternalClaimBody(p2);
2825
- var VerifierSigFromRest = makeVerifierSig(p2);
2826
- var ExternalClaimFromRest = makeExternalClaim(p2);
2827
- var ValidatorConfigFromRest = makeValidatorConfig(p2);
2828
- var CommitteeConfigFromRest = makeCommitteeConfig(p2);
2829
- var CommitteeChangeFromRest = makeCommitteeChange(p2);
2830
- var FixedAmountOrBpsFromRest = makeFixedAmountOrBps(p2);
2831
- var EscrowCreateConfigFromRest = makeEscrowCreateConfig(p2);
2832
- var EscrowCreateJobFromRest = makeEscrowCreateJob(p2);
2833
- var EscrowSubmitFromRest = makeEscrowSubmit(p2);
2834
- var EscrowRejectFromRest = makeEscrowReject(p2);
2835
- var EscrowCompleteFromRest = makeEscrowComplete(p2);
2836
- var EscrowFromRest = makeEscrow(p2);
2837
- var OperationFromRest = makeOperation(p2);
2838
- var ClaimTypeFromRest = makeClaimType(p2);
2839
- var TransactionRelease20260319FromRest = makeTransactionRelease20260319(p2);
2840
- var TransactionRelease20260407FromRest = makeTransactionRelease20260407(p2);
2841
- var TransactionFromRest = makeTransaction(p2);
2842
- var VersionedTransactionFromRest = makeVersionedTransaction(p2);
2843
- var MultiSigConfigFromRest = makeMultiSigConfig(p2);
2844
- var MultiSigFromRest = makeMultiSig(p2);
2845
- var SignatureOrMultiSigFromRest = makeSignatureOrMultiSig(p2);
2846
- var TransactionEnvelopeFromRest = makeTransactionEnvelope(p2);
2847
- var ValidatedTransactionFromRest = makeValidatedTransaction(p2);
2848
- var TransactionCertificateFromRest = makeTransactionCertificate(p2);
2849
- var NonceRangeFromRest = makeNonceRange(p2);
2850
- var PageRequestFromRest = makePageRequest(p2);
2851
- var TokenMetadataFromRest = makeTokenMetadata(p2);
2852
- var AccountInfoResponseFromRest = makeAccountInfoResponse(p2);
2853
- var TokenInfoResponseFromRest = makeTokenInfoResponse(p2);
2854
- var SubmitTransactionResponseFromRest = makeSubmitTransactionResponse(p2);
2855
- var ConfirmTransactionResponseFromRest = makeConfirmTransactionResponse(p2);
2856
- var ProxySubmitTransactionResultFromRest = makeProxySubmitTransactionResult(p2);
2857
- var EscrowJobRecordFromRest = makeEscrowJobRecord(p2);
2858
- var EscrowJobWithCertsFromRest = makeEscrowJobWithCerts(p2);
2859
- var p3 = RpcPalette;
2860
- var TokenTransferFromRpc = makeTokenTransfer(p3);
2861
- var TokenCreationFromRpc = makeTokenCreation(p3);
2862
- var TokenManagementFromRpc = makeTokenManagement(p3);
2863
- var MintFromRpc = makeMint(p3);
2864
- var BurnFromRpc = makeBurn(p3);
2865
- var StateInitializationFromRpc = makeStateInitialization(p3);
2866
- var StateUpdateFromRpc = makeStateUpdate(p3);
2867
- var StateResetFromRpc = makeStateReset(p3);
2868
- var ExternalClaimBodyFromRpc = makeExternalClaimBody(p3);
2869
- var VerifierSigFromRpc = makeVerifierSig(p3);
2870
- var ExternalClaimFromRpc = makeExternalClaim(p3);
2871
- var ValidatorConfigFromRpc = makeValidatorConfig(p3);
2872
- var CommitteeConfigFromRpc = makeCommitteeConfig(p3);
2873
- var CommitteeChangeFromRpc = makeCommitteeChange(p3);
2874
- var FixedAmountOrBpsFromRpc = makeFixedAmountOrBps(p3);
2875
- var EscrowCreateConfigFromRpc = makeEscrowCreateConfig(p3);
2876
- var EscrowCreateJobFromRpc = makeEscrowCreateJob(p3);
2877
- var EscrowSubmitFromRpc = makeEscrowSubmit(p3);
2878
- var EscrowRejectFromRpc = makeEscrowReject(p3);
2879
- var EscrowCompleteFromRpc = makeEscrowComplete(p3);
2880
- var EscrowFromRpc = makeEscrow(p3);
2881
- var OperationFromRpc = makeOperation(p3);
2882
- var ClaimTypeFromRpc = makeClaimType(p3);
2883
- var TransactionRelease20260319FromRpc = makeTransactionRelease20260319(p3);
2884
- var TransactionRelease20260407FromRpc = makeTransactionRelease20260407(p3);
2885
- var TransactionFromRpc = makeTransaction(p3);
2886
- var VersionedTransactionFromRpc = makeVersionedTransaction(p3);
2887
- var MultiSigConfigFromRpc = makeMultiSigConfig(p3);
2888
- var MultiSigFromRpc = makeMultiSig(p3);
2889
- var SignatureOrMultiSigFromRpc = makeSignatureOrMultiSig(p3);
2890
- var TransactionEnvelopeFromRpc = makeTransactionEnvelope(p3);
2891
- var ValidatedTransactionFromRpc = makeValidatedTransaction(p3);
2892
- var TransactionCertificateFromRpc = makeTransactionCertificate(p3);
2893
- var NonceRangeFromRpc = makeNonceRange(p3);
2894
- var PageRequestFromRpc = makePageRequest(p3);
2895
- var TokenMetadataFromRpc = makeTokenMetadata(p3);
2896
- var AccountInfoResponseFromRpc = makeAccountInfoResponse(p3);
2897
- var TokenInfoResponseFromRpc = makeTokenInfoResponse(p3);
2898
- var SubmitTransactionResponseFromRpc = makeSubmitTransactionResponse(p3);
2899
- var ConfirmTransactionResponseFromRpc = makeConfirmTransactionResponse(p3);
2900
- var ProxySubmitTransactionResultFromRpc = makeProxySubmitTransactionResult(p3);
2901
- var EscrowJobRecordFromRpc = makeEscrowJobRecord(p3);
2902
- var EscrowJobWithCertsFromRpc = makeEscrowJobWithCerts(p3);
2903
- var SubmitTransactionParamsFromRpc = makeSubmitTransactionParams(p3);
2904
- var FaucetDripParamsFromRpc = makeFaucetDripParams(p3);
2905
- var GetAccountInfoParamsFromRpc = makeGetAccountInfoParams(p3);
2906
- var GetPendingMultisigParamsFromRpc = makeGetPendingMultisigParams(p3);
2907
- var GetTokenInfoParamsFromRpc = makeGetTokenInfoParams(p3);
2908
- var GetTransactionCertificatesParamsFromRpc = makeGetTransactionCertificatesParams(p3);
2909
-
2910
739
  // ../../packages/fast-sdk/dist/chunk-2WOJNW4N.js
2911
- import { Effect as Effect4, Encoding as Encoding2, Schema as Schema22 } from "effect";
740
+ import { Effect as Effect4, Encoding as Encoding2, Schema as Schema2 } from "effect";
2912
741
 
2913
742
  // ../../node_modules/.pnpm/@noble+ed25519@3.0.1/node_modules/@noble/ed25519/index.js
2914
743
  var ed25519_CURVE = {
@@ -2934,9 +763,9 @@ var err = (message2 = "") => {
2934
763
  };
2935
764
  var isBig = (n) => typeof n === "bigint";
2936
765
  var isStr = (s) => typeof s === "string";
2937
- var isBytes3 = (a) => a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
766
+ var isBytes2 = (a) => a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
2938
767
  var abytes2 = (value, length, title = "") => {
2939
- const bytes = isBytes3(value);
768
+ const bytes = isBytes2(value);
2940
769
  const len = value?.length;
2941
770
  const needsLen = length !== void 0;
2942
771
  if (!bytes || needsLen && len !== length) {
@@ -3016,7 +845,7 @@ var invert = (num, md) => {
3016
845
  }
3017
846
  return b === 1n ? M(x, md) : err("no inverse");
3018
847
  };
3019
- var apoint = (p4) => p4 instanceof Point ? p4 : err("Point expected");
848
+ var apoint = (p) => p instanceof Point ? p : err("Point expected");
3020
849
  var B256 = 2n ** 256n;
3021
850
  var Point = class _Point {
3022
851
  static BASE;
@@ -3036,8 +865,8 @@ var Point = class _Point {
3036
865
  static CURVE() {
3037
866
  return ed25519_CURVE;
3038
867
  }
3039
- static fromAffine(p4) {
3040
- return new _Point(p4.x, p4.y, 1n, modP(p4.x * p4.y));
868
+ static fromAffine(p) {
869
+ return new _Point(p.x, p.y, 1n, modP(p.x * p.y));
3041
870
  }
3042
871
  /** RFC8032 5.1.3: Uint8Array to Point. */
3043
872
  static fromBytes(hex, zip215 = false) {
@@ -3075,10 +904,10 @@ var Point = class _Point {
3075
904
  assertValidity() {
3076
905
  const a = _a;
3077
906
  const d = _d;
3078
- const p4 = this;
3079
- if (p4.is0())
907
+ const p = this;
908
+ if (p.is0())
3080
909
  return err("bad point: ZERO");
3081
- const { X, Y, Z, T } = p4;
910
+ const { X, Y, Z, T } = p;
3082
911
  const X2 = modP(X * X);
3083
912
  const Y2 = modP(Y * Y);
3084
913
  const Z2 = modP(Z * Z);
@@ -3168,15 +997,15 @@ var Point = class _Point {
3168
997
  return this;
3169
998
  if (this.equals(G))
3170
999
  return wNAF(n).p;
3171
- let p4 = I;
1000
+ let p = I;
3172
1001
  let f = G;
3173
1002
  for (let d = this; n > 0n; d = d.double(), n >>= 1n) {
3174
1003
  if (n & 1n)
3175
- p4 = p4.add(d);
1004
+ p = p.add(d);
3176
1005
  else if (safe)
3177
1006
  f = f.add(d);
3178
1007
  }
3179
- return p4;
1008
+ return p;
3180
1009
  }
3181
1010
  multiplyUnsafe(scalar) {
3182
1011
  return this.multiply(scalar, false);
@@ -3209,10 +1038,10 @@ var Point = class _Point {
3209
1038
  return this.clearCofactor().is0();
3210
1039
  }
3211
1040
  isTorsionFree() {
3212
- let p4 = this.multiply(N / 2n, false).double();
1041
+ let p = this.multiply(N / 2n, false).double();
3213
1042
  if (N % 2n)
3214
- p4 = p4.add(this);
3215
- return p4.is0();
1043
+ p = p.add(this);
1044
+ return p.is0();
3216
1045
  }
3217
1046
  };
3218
1047
  var G = new Point(Gx, Gy, 1n, M(Gx * Gy));
@@ -3277,7 +1106,7 @@ var hash2extK = (hashed) => {
3277
1106
  return { head, prefix, scalar, point, pointBytes };
3278
1107
  };
3279
1108
  var getExtendedPublicKeyAsync = (secretKey) => sha512a(abytes2(secretKey, L)).then(hash2extK);
3280
- var getPublicKeyAsync = (secretKey) => getExtendedPublicKeyAsync(secretKey).then((p4) => p4.pointBytes);
1109
+ var getPublicKeyAsync = (secretKey) => getExtendedPublicKeyAsync(secretKey).then((p) => p.pointBytes);
3281
1110
  var hashFinishA = (res) => sha512a(res.hashable).then(res.finish);
3282
1111
  var _sign = (e, rBytes, msg) => {
3283
1112
  const { pointBytes: P2, scalar: s } = e;
@@ -3310,27 +1139,27 @@ var pwindows = Math.ceil(scalarBits / W) + 1;
3310
1139
  var pwindowSize = 2 ** (W - 1);
3311
1140
  var precompute = () => {
3312
1141
  const points = [];
3313
- let p4 = G;
3314
- let b = p4;
1142
+ let p = G;
1143
+ let b = p;
3315
1144
  for (let w = 0; w < pwindows; w++) {
3316
- b = p4;
1145
+ b = p;
3317
1146
  points.push(b);
3318
1147
  for (let i = 1; i < pwindowSize; i++) {
3319
- b = b.add(p4);
1148
+ b = b.add(p);
3320
1149
  points.push(b);
3321
1150
  }
3322
- p4 = b.double();
1151
+ p = b.double();
3323
1152
  }
3324
1153
  return points;
3325
1154
  };
3326
1155
  var Gpows = void 0;
3327
- var ctneg = (cnd, p4) => {
3328
- const n = p4.negate();
3329
- return cnd ? n : p4;
1156
+ var ctneg = (cnd, p) => {
1157
+ const n = p.negate();
1158
+ return cnd ? n : p;
3330
1159
  };
3331
1160
  var wNAF = (n) => {
3332
1161
  const comp = Gpows || (Gpows = precompute());
3333
- let p4 = I;
1162
+ let p = I;
3334
1163
  let f = G;
3335
1164
  const pow_2_w = 2 ** W;
3336
1165
  const maxNum = pow_2_w;
@@ -3351,17 +1180,17 @@ var wNAF = (n) => {
3351
1180
  if (wbits === 0) {
3352
1181
  f = f.add(ctneg(isEven, comp[offF]));
3353
1182
  } else {
3354
- p4 = p4.add(ctneg(isNeg, comp[offP]));
1183
+ p = p.add(ctneg(isNeg, comp[offP]));
3355
1184
  }
3356
1185
  }
3357
1186
  if (n !== 0n)
3358
1187
  err("invalid wnaf");
3359
- return { p: p4, f };
1188
+ return { p, f };
3360
1189
  };
3361
1190
 
3362
1191
  // ../../packages/fast-sdk/dist/chunk-2WOJNW4N.js
3363
1192
  import { Effect as Effect5 } from "effect";
3364
- import { Effect as Effect6, Schema as Schema32 } from "effect";
1193
+ import { Effect as Effect6, Schema as Schema3 } from "effect";
3365
1194
  var BcsEncodeError = class extends Data.TaggedError("BcsEncodeError") {
3366
1195
  };
3367
1196
  var SigningError = class extends Data.TaggedError("SigningError") {
@@ -3494,17 +1323,17 @@ var parseRestError = (status, err2) => {
3494
1323
  return new RestError({ status, code, message: message2, details });
3495
1324
  }
3496
1325
  };
3497
- var RestSuccessEnvelope = Schema19.Struct({
3498
- data: Schema19.Unknown,
3499
- meta: Schema19.Struct({ timestamp: Schema19.String })
1326
+ var RestSuccessEnvelope = Schema.Struct({
1327
+ data: Schema.Unknown,
1328
+ meta: Schema.Struct({ timestamp: Schema.String })
3500
1329
  });
3501
- var RestErrorEnvelope = Schema19.Struct({
3502
- error: Schema19.Struct({
3503
- code: Schema19.String,
3504
- message: Schema19.String,
3505
- details: Schema19.optional(Schema19.Unknown)
1330
+ var RestErrorEnvelope = Schema.Struct({
1331
+ error: Schema.Struct({
1332
+ code: Schema.String,
1333
+ message: Schema.String,
1334
+ details: Schema.optional(Schema.Unknown)
3506
1335
  }),
3507
- meta: Schema19.Struct({ timestamp: Schema19.String })
1336
+ meta: Schema.Struct({ timestamp: Schema.String })
3508
1337
  });
3509
1338
  var restCallEffect = (baseUrl, opts) => {
3510
1339
  const timeoutMs = opts.timeoutMs ?? 15e3;
@@ -3532,10 +1361,10 @@ var restCallEffect = (baseUrl, opts) => {
3532
1361
  });
3533
1362
  }
3534
1363
  if (!res.ok) {
3535
- const errEnv = yield* Schema19.decodeUnknown(RestErrorEnvelope)(json);
1364
+ const errEnv = yield* Schema.decodeUnknown(RestErrorEnvelope)(json);
3536
1365
  return yield* parseRestError(res.status, errEnv.error);
3537
1366
  }
3538
- const okEnv = yield* Schema19.decodeUnknown(RestSuccessEnvelope)(json);
1367
+ const okEnv = yield* Schema.decodeUnknown(RestSuccessEnvelope)(json);
3539
1368
  return okEnv.data;
3540
1369
  }).pipe(
3541
1370
  Effect3.timeout(`${timeoutMs} millis`),
@@ -3545,10 +1374,10 @@ var restCallEffect = (baseUrl, opts) => {
3545
1374
  )
3546
1375
  );
3547
1376
  };
3548
- var addressToStr = (addr) => Schema22.encodeSync(AddressFromRest)(addr);
3549
- var tokenIdToHex = (id) => Schema22.encodeSync(TokenIdFromRest)(id);
1377
+ var addressToStr = (addr) => Schema2.encodeSync(AddressFromRest)(addr);
1378
+ var tokenIdToHex = (id) => Schema2.encodeSync(TokenIdFromRest)(id);
3550
1379
  var submitTransaction = (url, params) => Effect4.gen(function* () {
3551
- const bcsEncoded = yield* Schema22.encode(VersionedTransactionFromBcs)(
1380
+ const bcsEncoded = yield* Schema2.encode(VersionedTransactionFromBcs)(
3552
1381
  params.transaction
3553
1382
  );
3554
1383
  const txBytes = yield* encode(
@@ -3556,7 +1385,7 @@ var submitTransaction = (url, params) => Effect4.gen(function* () {
3556
1385
  bcsEncoded
3557
1386
  );
3558
1387
  const txHex = Encoding2.encodeHex(txBytes);
3559
- const sigBcsEncoded = yield* Schema22.encode(SignatureOrMultiSigFromBcs)(
1388
+ const sigBcsEncoded = yield* Schema2.encode(SignatureOrMultiSigFromBcs)(
3560
1389
  params.signature
3561
1390
  );
3562
1391
  const sigBytes = yield* encode(
@@ -3573,7 +1402,7 @@ var submitTransaction = (url, params) => Effect4.gen(function* () {
3573
1402
  witness_certificates: []
3574
1403
  }
3575
1404
  });
3576
- return yield* Schema22.decodeUnknown(ProxySubmitTransactionResultFromRest)(
1405
+ return yield* Schema2.decodeUnknown(ProxySubmitTransactionResultFromRest)(
3577
1406
  result2
3578
1407
  );
3579
1408
  });
@@ -3587,7 +1416,7 @@ var getAccountInfo = (url, params) => Effect4.gen(function* () {
3587
1416
  state_key_filter: params.stateKeyFilter ? params.stateKeyFilter.map((k) => Encoding2.encodeHex(k)).join(",") : void 0
3588
1417
  }
3589
1418
  });
3590
- return yield* Schema22.decodeUnknown(AccountInfoResponseFromRest)(result2);
1419
+ return yield* Schema2.decodeUnknown(AccountInfoResponseFromRest)(result2);
3591
1420
  });
3592
1421
  var getPendingMultisigTransactions = (url, params) => Effect4.gen(function* () {
3593
1422
  const addr = addressToStr(params.address);
@@ -3595,8 +1424,8 @@ var getPendingMultisigTransactions = (url, params) => Effect4.gen(function* () {
3595
1424
  method: "GET",
3596
1425
  path: `/v1/accounts/${addr}/pending-multisig-transactions`
3597
1426
  });
3598
- return yield* Schema22.decodeUnknown(
3599
- Schema22.Array(TransactionEnvelopeFromRest)
1427
+ return yield* Schema2.decodeUnknown(
1428
+ Schema2.Array(TransactionEnvelopeFromRest)
3600
1429
  )(result2);
3601
1430
  });
3602
1431
  var getTokenInfo = (url, params) => Effect4.gen(function* () {
@@ -3607,7 +1436,7 @@ var getTokenInfo = (url, params) => Effect4.gen(function* () {
3607
1436
  token_ids: params.tokenIds.map(tokenIdToHex).join(",")
3608
1437
  }
3609
1438
  });
3610
- return yield* Schema22.decodeUnknown(TokenInfoResponseFromRest)(result2);
1439
+ return yield* Schema2.decodeUnknown(TokenInfoResponseFromRest)(result2);
3611
1440
  });
3612
1441
  var getTransactionCertificates = (url, params) => Effect4.gen(function* () {
3613
1442
  const addr = addressToStr(params.address);
@@ -3619,8 +1448,8 @@ var getTransactionCertificates = (url, params) => Effect4.gen(function* () {
3619
1448
  limit: params.limit.toString()
3620
1449
  }
3621
1450
  });
3622
- return yield* Schema22.decodeUnknown(
3623
- Schema22.Array(TransactionCertificateFromRest)
1451
+ return yield* Schema2.decodeUnknown(
1452
+ Schema2.Array(TransactionCertificateFromRest)
3624
1453
  )(result2);
3625
1454
  });
3626
1455
  var getEscrowJob = (url, params) => Effect4.gen(function* () {
@@ -3631,9 +1460,9 @@ var getEscrowJob = (url, params) => Effect4.gen(function* () {
3631
1460
  query: { certs: params.certs ? "true" : void 0 }
3632
1461
  });
3633
1462
  if (params.certs) {
3634
- return yield* Schema22.decodeUnknown(EscrowJobWithCertsFromRest)(result2);
1463
+ return yield* Schema2.decodeUnknown(EscrowJobWithCertsFromRest)(result2);
3635
1464
  }
3636
- return yield* Schema22.decodeUnknown(EscrowJobRecordFromRest)(result2);
1465
+ return yield* Schema2.decodeUnknown(EscrowJobRecordFromRest)(result2);
3637
1466
  });
3638
1467
  var getEscrowJobs = (url, params) => Effect4.gen(function* () {
3639
1468
  const result2 = yield* restCallEffect(url, {
@@ -3648,11 +1477,11 @@ var getEscrowJobs = (url, params) => Effect4.gen(function* () {
3648
1477
  }
3649
1478
  });
3650
1479
  if (params.certs) {
3651
- return yield* Schema22.decodeUnknown(
3652
- Schema22.Array(EscrowJobWithCertsFromRest)
1480
+ return yield* Schema2.decodeUnknown(
1481
+ Schema2.Array(EscrowJobWithCertsFromRest)
3653
1482
  )(result2);
3654
1483
  }
3655
- return yield* Schema22.decodeUnknown(Schema22.Array(EscrowJobRecordFromRest))(
1484
+ return yield* Schema2.decodeUnknown(Schema2.Array(EscrowJobRecordFromRest))(
3656
1485
  result2
3657
1486
  );
3658
1487
  });
@@ -3669,7 +1498,7 @@ var getPublicKey = (privateKey) => Effect5.tryPromise({
3669
1498
  catch: (cause) => new PublicKeyError({ cause })
3670
1499
  });
3671
1500
  var buildSignedEnvelope = (privateKey, transaction) => Effect6.gen(function* () {
3672
- const bcsEncoded = yield* Schema32.encode(VersionedTransactionFromBcs)(
1501
+ const bcsEncoded = yield* Schema3.encode(VersionedTransactionFromBcs)(
3673
1502
  transaction
3674
1503
  );
3675
1504
  const rawSig = yield* signTypedData(
@@ -3677,7 +1506,7 @@ var buildSignedEnvelope = (privateKey, transaction) => Effect6.gen(function* ()
3677
1506
  bcs_layout_exports.VersionedTransaction,
3678
1507
  bcsEncoded
3679
1508
  );
3680
- const signature = yield* Schema32.decodeUnknown(SignatureFromInput)(rawSig);
1509
+ const signature = yield* Schema3.decodeUnknown(SignatureFromInput)(rawSig);
3681
1510
  return {
3682
1511
  transaction,
3683
1512
  signature: { type: "Signature", value: signature }
@@ -3685,82 +1514,90 @@ var buildSignedEnvelope = (privateKey, transaction) => Effect6.gen(function* ()
3685
1514
  });
3686
1515
 
3687
1516
  // ../../packages/fast-sdk/dist/index.js
3688
- import { bech32m as bech32m2 } from "bech32";
1517
+ import { bech32m } from "bech32";
3689
1518
  import { Encoding as Encoding3 } from "effect";
3690
- import { Schema as Schema20 } from "effect";
3691
- import { Redacted, Schema as Schema23 } from "effect";
3692
- import { Schema as Schema33 } from "effect";
3693
- var toHex3 = (bytes) => `0x${Encoding3.encodeHex(bytes)}`;
3694
- var fromHex3 = (hex) => {
1519
+ import { Schema as Schema4 } from "effect";
1520
+ import { Redacted, Schema as Schema22 } from "effect";
1521
+ import { Schema as Schema32 } from "effect";
1522
+ var toHex2 = (bytes) => `0x${Encoding3.encodeHex(bytes)}`;
1523
+ var fromHex2 = (hex) => {
3695
1524
  const stripped = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
3696
1525
  const result2 = Encoding3.decodeHex(stripped);
3697
1526
  if (result2._tag === "Left") throw new Error(`Invalid hex string: ${hex}`);
3698
1527
  return result2.right;
3699
1528
  };
3700
- var toFastAddress = (bytes) => bech32m2.encode("fast", bech32m2.toWords(bytes));
1529
+ var toFastAddress = (bytes) => bech32m.encode("fast", bech32m.toWords(bytes));
3701
1530
  var fromFastAddress = (address) => {
3702
- const { prefix, words } = bech32m2.decode(address);
1531
+ const { prefix, words } = bech32m.decode(address);
3703
1532
  if (prefix !== "fast")
3704
1533
  throw new Error(`Expected "fast" prefix, got "${prefix}"`);
3705
- return new Uint8Array(bech32m2.fromWords(words));
1534
+ return new Uint8Array(bech32m.fromWords(words));
3706
1535
  };
3707
1536
  var hashHex2 = (schema, message2) => run(hashHex(schema, message2));
3708
1537
  var FastProvider = class {
3709
- _url;
1538
+ _network;
3710
1539
  constructor(opts) {
3711
- this._url = opts.url;
1540
+ this._network = {
1541
+ url: opts.url,
1542
+ networkId: opts.networkId,
1543
+ explorerUrl: opts.explorerUrl
1544
+ };
1545
+ }
1546
+ /** The {@link FastNetwork} this provider targets. */
1547
+ get network() {
1548
+ return this._network;
3712
1549
  }
3713
1550
  /** The proxy base URL this provider was constructed with. */
3714
1551
  get url() {
3715
- return this._url;
1552
+ return this._network.url;
3716
1553
  }
3717
1554
  /**
3718
1555
  * Submit a signed transaction envelope to the network.
3719
1556
  * The envelope should be produced by {@link TransactionBuilder.sign}.
3720
1557
  */
3721
1558
  async submitTransaction(params) {
3722
- return run(submitTransaction(this._url, params));
1559
+ return run(submitTransaction(this._network.url, params));
3723
1560
  }
3724
1561
  /**
3725
1562
  * Fetch account information including balance, nonce, token balances, and state.
3726
1563
  * Use filters to request specific token balances or state keys.
3727
1564
  */
3728
1565
  async getAccountInfo(params) {
3729
- const internal = Schema20.decodeUnknownSync(GetAccountInfoInput)(params);
3730
- return run(getAccountInfo(this._url, internal));
1566
+ const internal = Schema4.decodeUnknownSync(GetAccountInfoInput)(params);
1567
+ return run(getAccountInfo(this._network.url, internal));
3731
1568
  }
3732
1569
  /** Fetch pending multisig transactions for the given address. */
3733
1570
  async getPendingMultisigTransactions(params) {
3734
- const internal = Schema20.decodeUnknownSync(GetPendingMultisigInput)(params);
3735
- return run(getPendingMultisigTransactions(this._url, internal));
1571
+ const internal = Schema4.decodeUnknownSync(GetPendingMultisigInput)(params);
1572
+ return run(getPendingMultisigTransactions(this._network.url, internal));
3736
1573
  }
3737
1574
  /** Fetch metadata for one or more tokens by their IDs. */
3738
1575
  async getTokenInfo(params) {
3739
- const internal = Schema20.decodeUnknownSync(GetTokenInfoInput)(params);
3740
- return run(getTokenInfo(this._url, internal));
1576
+ const internal = Schema4.decodeUnknownSync(GetTokenInfoInput)(params);
1577
+ return run(getTokenInfo(this._network.url, internal));
3741
1578
  }
3742
1579
  /**
3743
1580
  * Fetch finalized transaction certificates for an address.
3744
1581
  * Results are paginated by nonce range.
3745
1582
  */
3746
1583
  async getTransactionCertificates(params) {
3747
- const internal = Schema20.decodeUnknownSync(GetTransactionCertificatesInput)(
1584
+ const internal = Schema4.decodeUnknownSync(GetTransactionCertificatesInput)(
3748
1585
  params
3749
1586
  );
3750
- return run(getTransactionCertificates(this._url, internal));
1587
+ return run(getTransactionCertificates(this._network.url, internal));
3751
1588
  }
3752
1589
  /** Fetch a single escrow job by ID, optionally including certificates. */
3753
1590
  async getEscrowJob(params) {
3754
- const internal = Schema20.decodeUnknownSync(GetEscrowJobInput)(params);
3755
- return run(getEscrowJob(this._url, internal));
1591
+ const internal = Schema4.decodeUnknownSync(GetEscrowJobInput)(params);
1592
+ return run(getEscrowJob(this._network.url, internal));
3756
1593
  }
3757
1594
  /**
3758
1595
  * List escrow jobs filtered by role (client, provider, or evaluator).
3759
1596
  * Optionally filter by status and include certificates.
3760
1597
  */
3761
1598
  async getEscrowJobs(params) {
3762
- const internal = Schema20.decodeUnknownSync(GetEscrowJobsInput)(params);
3763
- return run(getEscrowJobs(this._url, internal));
1599
+ const internal = Schema4.decodeUnknownSync(GetEscrowJobsInput)(params);
1600
+ return run(getEscrowJobs(this._network.url, internal));
3764
1601
  }
3765
1602
  };
3766
1603
  var Signer = class {
@@ -3772,7 +1609,7 @@ var Signer = class {
3772
1609
  * @throws ParseError if the key is not exactly 32 bytes.
3773
1610
  */
3774
1611
  constructor(privateKey) {
3775
- const key = Schema23.decodeUnknownSync(PrivateKeyFromInput)(privateKey);
1612
+ const key = Schema22.decodeUnknownSync(PrivateKeyFromInput)(privateKey);
3776
1613
  this.privateKey = Redacted.make(key);
3777
1614
  }
3778
1615
  /** Return the raw private key bytes. Handle with care. */
@@ -3900,7 +1737,7 @@ var TransactionBuilder = class {
3900
1737
  const ops = this.operations;
3901
1738
  const type = version ?? LatestTransactionVersion;
3902
1739
  const config = getTransactionVersionConfig(type);
3903
- const internal = Schema33.decodeUnknownSync(config.inputSchema)({
1740
+ const internal = Schema32.decodeUnknownSync(config.inputSchema)({
3904
1741
  networkId,
3905
1742
  sender,
3906
1743
  nonce,
@@ -4203,11 +2040,11 @@ async function recoverAuthorizationAddress(parameters) {
4203
2040
 
4204
2041
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/errors/estimateGas.js
4205
2042
  var EstimateGasExecutionError = class extends BaseError {
4206
- constructor(cause, { account, docsPath: docsPath3, chain: chain2, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value }) {
2043
+ constructor(cause, { account, docsPath: docsPath3, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value }) {
4207
2044
  const prettyArgs = prettyPrint({
4208
2045
  from: account?.address,
4209
2046
  to,
4210
- value: typeof value !== "undefined" && `${formatEther(value)} ${chain2?.nativeCurrency?.symbol || "ETH"}`,
2047
+ value: typeof value !== "undefined" && `${formatEther(value)} ${chain?.nativeCurrency?.symbol || "ETH"}`,
4211
2048
  data,
4212
2049
  gas,
4213
2050
  gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
@@ -4414,9 +2251,9 @@ async function estimateMaxPriorityFeePerGas(client, args) {
4414
2251
  return internal_estimateMaxPriorityFeePerGas(client, args);
4415
2252
  }
4416
2253
  async function internal_estimateMaxPriorityFeePerGas(client, args) {
4417
- const { block: block_, chain: chain2 = client.chain, request } = args || {};
2254
+ const { block: block_, chain = client.chain, request } = args || {};
4418
2255
  try {
4419
- const maxPriorityFeePerGas = chain2?.fees?.maxPriorityFeePerGas ?? chain2?.fees?.defaultPriorityFee;
2256
+ const maxPriorityFeePerGas = chain?.fees?.maxPriorityFeePerGas ?? chain?.fees?.defaultPriorityFee;
4420
2257
  if (typeof maxPriorityFeePerGas === "function") {
4421
2258
  const block = block_ || await getAction(client, getBlock, "getBlock")({});
4422
2259
  const maxPriorityFeePerGas_ = await maxPriorityFeePerGas({
@@ -4453,15 +2290,15 @@ async function estimateFeesPerGas(client, args) {
4453
2290
  return internal_estimateFeesPerGas(client, args);
4454
2291
  }
4455
2292
  async function internal_estimateFeesPerGas(client, args) {
4456
- const { block: block_, chain: chain2 = client.chain, request, type = "eip1559" } = args || {};
2293
+ const { block: block_, chain = client.chain, request, type = "eip1559" } = args || {};
4457
2294
  const baseFeeMultiplier = await (async () => {
4458
- if (typeof chain2?.fees?.baseFeeMultiplier === "function")
4459
- return chain2.fees.baseFeeMultiplier({
2295
+ if (typeof chain?.fees?.baseFeeMultiplier === "function")
2296
+ return chain.fees.baseFeeMultiplier({
4460
2297
  block: block_,
4461
2298
  client,
4462
2299
  request
4463
2300
  });
4464
- return chain2?.fees?.baseFeeMultiplier ?? 1.2;
2301
+ return chain?.fees?.baseFeeMultiplier ?? 1.2;
4465
2302
  })();
4466
2303
  if (baseFeeMultiplier < 1)
4467
2304
  throw new BaseFeeScalarError();
@@ -4469,8 +2306,8 @@ async function internal_estimateFeesPerGas(client, args) {
4469
2306
  const denominator = 10 ** decimals;
4470
2307
  const multiply = (base2) => base2 * BigInt(Math.ceil(baseFeeMultiplier * denominator)) / BigInt(denominator);
4471
2308
  const block = block_ ? block_ : await getAction(client, getBlock, "getBlock")({});
4472
- if (typeof chain2?.fees?.estimateFeesPerGas === "function") {
4473
- const fees = await chain2.fees.estimateFeesPerGas({
2309
+ if (typeof chain?.fees?.estimateFeesPerGas === "function") {
2310
+ const fees = await chain.fees.estimateFeesPerGas({
4474
2311
  block: block_,
4475
2312
  client,
4476
2313
  multiply,
@@ -4485,7 +2322,7 @@ async function internal_estimateFeesPerGas(client, args) {
4485
2322
  throw new Eip1559FeesNotSupportedError();
4486
2323
  const maxPriorityFeePerGas = typeof request?.maxPriorityFeePerGas === "bigint" ? request.maxPriorityFeePerGas : await internal_estimateMaxPriorityFeePerGas(client, {
4487
2324
  block,
4488
- chain: chain2,
2325
+ chain,
4489
2326
  request
4490
2327
  });
4491
2328
  const baseFeePerGas = multiply(block.baseFeePerGas);
@@ -4717,7 +2554,7 @@ async function getChainId(client) {
4717
2554
 
4718
2555
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/public/fillTransaction.js
4719
2556
  async function fillTransaction(client, parameters) {
4720
- const { account = client.account, accessList, authorizationList, chain: chain2 = client.chain, blobVersionedHashes, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce: nonce_, nonceManager, to, type, value, ...rest } = parameters;
2557
+ const { account = client.account, accessList, authorizationList, chain = client.chain, blobVersionedHashes, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce: nonce_, nonceManager, to, type, value, ...rest } = parameters;
4721
2558
  const nonce = await (async () => {
4722
2559
  if (!account)
4723
2560
  return nonce_;
@@ -4726,7 +2563,7 @@ async function fillTransaction(client, parameters) {
4726
2563
  if (typeof nonce_ !== "undefined")
4727
2564
  return nonce_;
4728
2565
  const account_ = parseAccount(account);
4729
- const chainId = chain2 ? chain2.id : await getAction(client, getChainId, "getChainId")({});
2566
+ const chainId = chain ? chain.id : await getAction(client, getChainId, "getChainId")({});
4730
2567
  return await nonceManager.consume({
4731
2568
  address: account_.address,
4732
2569
  chainId,
@@ -4734,7 +2571,7 @@ async function fillTransaction(client, parameters) {
4734
2571
  });
4735
2572
  })();
4736
2573
  assertRequest(parameters);
4737
- const chainFormat = chain2?.formatters?.transactionRequest?.format;
2574
+ const chainFormat = chain?.formatters?.transactionRequest?.format;
4738
2575
  const format = chainFormat || formatTransactionRequest;
4739
2576
  const request = format({
4740
2577
  // Pick out extra data that might exist on the chain's transaction request type.
@@ -4760,7 +2597,7 @@ async function fillTransaction(client, parameters) {
4760
2597
  method: "eth_fillTransaction",
4761
2598
  params: [request]
4762
2599
  });
4763
- const format2 = chain2?.formatters?.transaction?.format || formatTransaction;
2600
+ const format2 = chain?.formatters?.transaction?.format || formatTransaction;
4764
2601
  const transaction = format2(response.tx);
4765
2602
  delete transaction.blockHash;
4766
2603
  delete transaction.blockNumber;
@@ -4783,15 +2620,15 @@ async function fillTransaction(client, parameters) {
4783
2620
  if (transaction.nonce)
4784
2621
  transaction.nonce = parameters.nonce ?? transaction.nonce;
4785
2622
  const feeMultiplier = await (async () => {
4786
- if (typeof chain2?.fees?.baseFeeMultiplier === "function") {
2623
+ if (typeof chain?.fees?.baseFeeMultiplier === "function") {
4787
2624
  const block = await getAction(client, getBlock, "getBlock")({});
4788
- return chain2.fees.baseFeeMultiplier({
2625
+ return chain.fees.baseFeeMultiplier({
4789
2626
  block,
4790
2627
  client,
4791
2628
  request: parameters
4792
2629
  });
4793
2630
  }
4794
- return chain2?.fees?.baseFeeMultiplier ?? 1.2;
2631
+ return chain?.fees?.baseFeeMultiplier ?? 1.2;
4795
2632
  })();
4796
2633
  if (feeMultiplier < 1)
4797
2634
  throw new BaseFeeScalarError();
@@ -4832,17 +2669,17 @@ async function prepareTransactionRequest(client, args) {
4832
2669
  let request = args;
4833
2670
  request.account ??= client.account;
4834
2671
  request.parameters ??= defaultParameters;
4835
- const { account: account_, chain: chain2 = client.chain, nonceManager, parameters } = request;
2672
+ const { account: account_, chain = client.chain, nonceManager, parameters } = request;
4836
2673
  const prepareTransactionRequest2 = (() => {
4837
- if (typeof chain2?.prepareTransactionRequest === "function")
2674
+ if (typeof chain?.prepareTransactionRequest === "function")
4838
2675
  return {
4839
- fn: chain2.prepareTransactionRequest,
2676
+ fn: chain.prepareTransactionRequest,
4840
2677
  runAt: ["beforeFillTransaction"]
4841
2678
  };
4842
- if (Array.isArray(chain2?.prepareTransactionRequest))
2679
+ if (Array.isArray(chain?.prepareTransactionRequest))
4843
2680
  return {
4844
- fn: chain2.prepareTransactionRequest[0],
4845
- runAt: chain2.prepareTransactionRequest[1].runAt
2681
+ fn: chain.prepareTransactionRequest[0],
2682
+ runAt: chain.prepareTransactionRequest[1].runAt
4846
2683
  };
4847
2684
  return void 0;
4848
2685
  })();
@@ -4852,8 +2689,8 @@ async function prepareTransactionRequest(client, args) {
4852
2689
  return chainId;
4853
2690
  if (typeof request.chainId !== "undefined")
4854
2691
  return request.chainId;
4855
- if (chain2)
4856
- return chain2.id;
2692
+ if (chain)
2693
+ return chain.id;
4857
2694
  const chainId_ = await getAction(client, getChainId, "getChainId")({});
4858
2695
  chainId = chainId_;
4859
2696
  return chainId;
@@ -4869,7 +2706,7 @@ async function prepareTransactionRequest(client, args) {
4869
2706
  });
4870
2707
  }
4871
2708
  if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillTransaction")) {
4872
- request = await prepareTransactionRequest2.fn({ ...request, chain: chain2 }, {
2709
+ request = await prepareTransactionRequest2.fn({ ...request, chain }, {
4873
2710
  phase: "beforeFillTransaction"
4874
2711
  });
4875
2712
  nonce ??= request.nonce;
@@ -4928,7 +2765,7 @@ async function prepareTransactionRequest(client, args) {
4928
2765
  };
4929
2766
  const { blobs, gas, kzg, type } = request;
4930
2767
  if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillParameters")) {
4931
- request = await prepareTransactionRequest2.fn({ ...request, chain: chain2 }, {
2768
+ request = await prepareTransactionRequest2.fn({ ...request, chain }, {
4932
2769
  phase: "beforeFillParameters"
4933
2770
  });
4934
2771
  }
@@ -4985,7 +2822,7 @@ async function prepareTransactionRequest(client, args) {
4985
2822
  const block2 = await getBlock2();
4986
2823
  const { maxFeePerGas, maxPriorityFeePerGas } = await internal_estimateFeesPerGas(client, {
4987
2824
  block: block2,
4988
- chain: chain2,
2825
+ chain,
4989
2826
  request
4990
2827
  });
4991
2828
  if (typeof request.maxPriorityFeePerGas === "undefined" && request.maxFeePerGas && request.maxFeePerGas < maxPriorityFeePerGas)
@@ -5002,7 +2839,7 @@ async function prepareTransactionRequest(client, args) {
5002
2839
  const block2 = await getBlock2();
5003
2840
  const { gasPrice: gasPrice_ } = await internal_estimateFeesPerGas(client, {
5004
2841
  block: block2,
5005
- chain: chain2,
2842
+ chain,
5006
2843
  request,
5007
2844
  type: "legacy"
5008
2845
  });
@@ -5017,7 +2854,7 @@ async function prepareTransactionRequest(client, args) {
5017
2854
  prepare: account?.type === "local" ? [] : ["blobVersionedHashes"]
5018
2855
  });
5019
2856
  if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("afterFillParameters"))
5020
- request = await prepareTransactionRequest2.fn({ ...request, chain: chain2 }, {
2857
+ request = await prepareTransactionRequest2.fn({ ...request, chain }, {
5021
2858
  phase: "afterFillParameters"
5022
2859
  });
5023
2860
  assertRequest(request);
@@ -5483,9 +3320,9 @@ function observe(observerId, callbacks, fn) {
5483
3320
  return;
5484
3321
  const cleanup2 = cleanupCache.get(observerId);
5485
3322
  if (listeners2.length === 1 && cleanup2) {
5486
- const p4 = cleanup2();
5487
- if (p4 instanceof Promise)
5488
- p4.catch(() => {
3323
+ const p = cleanup2();
3324
+ if (p instanceof Promise)
3325
+ p.catch(() => {
5489
3326
  });
5490
3327
  }
5491
3328
  unsubscribe();
@@ -5819,11 +3656,11 @@ var AccountTypeNotSupportedError = class extends BaseError {
5819
3656
  };
5820
3657
 
5821
3658
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/utils/chain/assertCurrentChain.js
5822
- function assertCurrentChain({ chain: chain2, currentChainId }) {
5823
- if (!chain2)
3659
+ function assertCurrentChain({ chain, currentChainId }) {
3660
+ if (!chain)
5824
3661
  throw new ChainNotFoundError();
5825
- if (currentChainId !== chain2.id)
5826
- throw new ChainMismatchError({ chain: chain2, currentChainId });
3662
+ if (currentChainId !== chain.id)
3663
+ throw new ChainMismatchError({ chain, currentChainId });
5827
3664
  }
5828
3665
 
5829
3666
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/wallet/sendRawTransaction.js
@@ -5837,7 +3674,7 @@ async function sendRawTransaction(client, { serializedTransaction }) {
5837
3674
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/wallet/sendTransaction.js
5838
3675
  var supportsWalletNamespace = new LruMap(128);
5839
3676
  async function sendTransaction(client, parameters) {
5840
- const { account: account_ = client.account, assertChainId = true, chain: chain2 = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, type, value, ...rest } = parameters;
3677
+ const { account: account_ = client.account, assertChainId = true, chain = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, type, value, ...rest } = parameters;
5841
3678
  if (typeof account_ === "undefined")
5842
3679
  throw new AccountNotFoundError2({
5843
3680
  docsPath: "/docs/actions/wallet/sendTransaction"
@@ -5860,12 +3697,12 @@ async function sendTransaction(client, parameters) {
5860
3697
  })();
5861
3698
  if (account?.type === "json-rpc" || account === null) {
5862
3699
  let chainId;
5863
- if (chain2 !== null) {
3700
+ if (chain !== null) {
5864
3701
  chainId = await getAction(client, getChainId, "getChainId")({});
5865
3702
  if (assertChainId)
5866
3703
  assertCurrentChain({
5867
3704
  currentChainId: chainId,
5868
- chain: chain2
3705
+ chain
5869
3706
  });
5870
3707
  }
5871
3708
  const chainFormat = client.chain?.formatters?.transactionRequest?.format;
@@ -5925,7 +3762,7 @@ async function sendTransaction(client, parameters) {
5925
3762
  accessList,
5926
3763
  authorizationList,
5927
3764
  blobs,
5928
- chain: chain2,
3765
+ chain,
5929
3766
  data: dataSuffix ? concat([data ?? "0x", dataSuffix]) : data,
5930
3767
  gas,
5931
3768
  gasPrice,
@@ -5940,7 +3777,7 @@ async function sendTransaction(client, parameters) {
5940
3777
  ...rest,
5941
3778
  to
5942
3779
  });
5943
- const serializer = chain2?.serializers?.transaction;
3780
+ const serializer = chain?.serializers?.transaction;
5944
3781
  const serializedTransaction = await account.signTransaction(request, {
5945
3782
  serializer
5946
3783
  });
@@ -6081,7 +3918,7 @@ var fallbackTransactionErrorMagicIdentifier = numberToHex(0, {
6081
3918
  size: 32
6082
3919
  });
6083
3920
  async function sendCalls(client, parameters) {
6084
- const { account: account_ = client.account, chain: chain2 = client.chain, experimental_fallback, experimental_fallbackDelay = 32, forceAtomic = false, id, version = "2.0.0" } = parameters;
3921
+ const { account: account_ = client.account, chain = client.chain, experimental_fallback, experimental_fallbackDelay = 32, forceAtomic = false, id, version = "2.0.0" } = parameters;
6085
3922
  const account = account_ ? parseAccount(account_) : null;
6086
3923
  let capabilities = parameters.capabilities;
6087
3924
  if (client.dataSuffix && !parameters.capabilities?.dataSuffix) {
@@ -6120,7 +3957,7 @@ async function sendCalls(client, parameters) {
6120
3957
  atomicRequired: forceAtomic,
6121
3958
  calls,
6122
3959
  capabilities,
6123
- chainId: numberToHex(chain2.id),
3960
+ chainId: numberToHex(chain.id),
6124
3961
  from: account?.address,
6125
3962
  id,
6126
3963
  version
@@ -6154,7 +3991,7 @@ async function sendCalls(client, parameters) {
6154
3991
  for (const call2 of calls) {
6155
3992
  const promise = sendTransaction(client, {
6156
3993
  account,
6157
- chain: chain2,
3994
+ chain,
6158
3995
  data: call2.data,
6159
3996
  to: call2.to,
6160
3997
  value: call2.value ? hexToBigInt(call2.value) : void 0
@@ -6174,7 +4011,7 @@ async function sendCalls(client, parameters) {
6174
4011
  return {
6175
4012
  id: concat([
6176
4013
  ...hashes2,
6177
- numberToHex(chain2.id, { size: 32 }),
4014
+ numberToHex(chain.id, { size: 32 }),
6178
4015
  fallbackMagicIdentifier
6179
4016
  ])
6180
4017
  };
@@ -6327,16 +4164,16 @@ function uid(length = 11) {
6327
4164
 
6328
4165
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/clients/createClient.js
6329
4166
  function createClient(parameters) {
6330
- const { batch, chain: chain2, ccipRead, dataSuffix, key = "base", name = "Base Client", type = "base" } = parameters;
6331
- const experimental_blockTag = parameters.experimental_blockTag ?? (typeof chain2?.experimental_preconfirmationTime === "number" ? "pending" : void 0);
6332
- const blockTime = chain2?.blockTime ?? 12e3;
4167
+ const { batch, chain, ccipRead, dataSuffix, key = "base", name = "Base Client", type = "base" } = parameters;
4168
+ const experimental_blockTag = parameters.experimental_blockTag ?? (typeof chain?.experimental_preconfirmationTime === "number" ? "pending" : void 0);
4169
+ const blockTime = chain?.blockTime ?? 12e3;
6333
4170
  const defaultPollingInterval = Math.min(Math.max(Math.floor(blockTime / 2), 500), 4e3);
6334
4171
  const pollingInterval = parameters.pollingInterval ?? defaultPollingInterval;
6335
4172
  const cacheTime = parameters.cacheTime ?? pollingInterval;
6336
4173
  const account = parameters.account ? parseAccount(parameters.account) : void 0;
6337
4174
  const { config, request, value } = parameters.transport({
6338
4175
  account,
6339
- chain: chain2,
4176
+ chain,
6340
4177
  pollingInterval
6341
4178
  });
6342
4179
  const transport = { ...config, ...value };
@@ -6345,7 +4182,7 @@ function createClient(parameters) {
6345
4182
  batch,
6346
4183
  cacheTime,
6347
4184
  ccipRead,
6348
- chain: chain2,
4185
+ chain,
6349
4186
  dataSuffix,
6350
4187
  key,
6351
4188
  name,
@@ -6455,19 +4292,19 @@ function packetToBytes(packet) {
6455
4292
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/ens/getEnsAddress.js
6456
4293
  async function getEnsAddress(client, parameters) {
6457
4294
  const { blockNumber, blockTag, coinType, name, gatewayUrls, strict } = parameters;
6458
- const { chain: chain2 } = client;
4295
+ const { chain } = client;
6459
4296
  const universalResolverAddress = (() => {
6460
4297
  if (parameters.universalResolverAddress)
6461
4298
  return parameters.universalResolverAddress;
6462
- if (!chain2)
4299
+ if (!chain)
6463
4300
  throw new Error("client chain not configured. universalResolverAddress is required.");
6464
4301
  return getChainContractAddress({
6465
4302
  blockNumber,
6466
- chain: chain2,
4303
+ chain,
6467
4304
  contract: "ensUniversalResolver"
6468
4305
  });
6469
4306
  })();
6470
- const tlds = chain2?.ensTlds;
4307
+ const tlds = chain?.ensTlds;
6471
4308
  if (tlds && !tlds.some((tld) => name.endsWith(tld)))
6472
4309
  return null;
6473
4310
  const args = (() => {
@@ -6752,19 +4589,19 @@ async function parseNftAvatarUri(client, { gatewayUrls, record: record2 }) {
6752
4589
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/ens/getEnsText.js
6753
4590
  async function getEnsText(client, parameters) {
6754
4591
  const { blockNumber, blockTag, key, name, gatewayUrls, strict } = parameters;
6755
- const { chain: chain2 } = client;
4592
+ const { chain } = client;
6756
4593
  const universalResolverAddress = (() => {
6757
4594
  if (parameters.universalResolverAddress)
6758
4595
  return parameters.universalResolverAddress;
6759
- if (!chain2)
4596
+ if (!chain)
6760
4597
  throw new Error("client chain not configured. universalResolverAddress is required.");
6761
4598
  return getChainContractAddress({
6762
4599
  blockNumber,
6763
- chain: chain2,
4600
+ chain,
6764
4601
  contract: "ensUniversalResolver"
6765
4602
  });
6766
4603
  })();
6767
- const tlds = chain2?.ensTlds;
4604
+ const tlds = chain?.ensTlds;
6768
4605
  if (tlds && !tlds.some((tld) => name.endsWith(tld)))
6769
4606
  return null;
6770
4607
  try {
@@ -6829,15 +4666,15 @@ async function getEnsAvatar(client, { blockNumber, blockTag, assetGatewayUrls, n
6829
4666
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/ens/getEnsName.js
6830
4667
  async function getEnsName(client, parameters) {
6831
4668
  const { address, blockNumber, blockTag, coinType = 60n, gatewayUrls, strict } = parameters;
6832
- const { chain: chain2 } = client;
4669
+ const { chain } = client;
6833
4670
  const universalResolverAddress = (() => {
6834
4671
  if (parameters.universalResolverAddress)
6835
4672
  return parameters.universalResolverAddress;
6836
- if (!chain2)
4673
+ if (!chain)
6837
4674
  throw new Error("client chain not configured. universalResolverAddress is required.");
6838
4675
  return getChainContractAddress({
6839
4676
  blockNumber,
6840
- chain: chain2,
4677
+ chain,
6841
4678
  contract: "ensUniversalResolver"
6842
4679
  });
6843
4680
  })();
@@ -6865,21 +4702,21 @@ async function getEnsName(client, parameters) {
6865
4702
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/ens/getEnsResolver.js
6866
4703
  async function getEnsResolver(client, parameters) {
6867
4704
  const { blockNumber, blockTag, name } = parameters;
6868
- const { chain: chain2 } = client;
4705
+ const { chain } = client;
6869
4706
  const universalResolverAddress = (() => {
6870
4707
  if (parameters.universalResolverAddress)
6871
4708
  return parameters.universalResolverAddress;
6872
- if (!chain2)
4709
+ if (!chain)
6873
4710
  throw new Error("client chain not configured. universalResolverAddress is required.");
6874
4711
  return getChainContractAddress({
6875
4712
  blockNumber,
6876
- chain: chain2,
4713
+ chain,
6877
4714
  contract: "ensUniversalResolver"
6878
4715
  });
6879
4716
  })();
6880
- const tlds = chain2?.ensTlds;
4717
+ const tlds = chain?.ensTlds;
6881
4718
  if (tlds && !tlds.some((tld) => name.endsWith(tld)))
6882
- throw new Error(`${name} is not a valid ENS TLD (${tlds?.join(", ")}) for chain "${chain2.name}" (id: ${chain2.id}).`);
4719
+ throw new Error(`${name} is not a valid ENS TLD (${tlds?.join(", ")}) for chain "${chain.name}" (id: ${chain.id}).`);
6883
4720
  const [resolverAddress] = await getAction(client, readContract, "readContract")({
6884
4721
  address: universalResolverAddress,
6885
4722
  abi: [
@@ -7681,12 +5518,12 @@ function shouldRetry(error) {
7681
5518
  }
7682
5519
 
7683
5520
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/utils/chain/defineChain.js
7684
- function defineChain(chain2) {
5521
+ function defineChain(chain) {
7685
5522
  const chainInstance = {
7686
5523
  formatters: void 0,
7687
5524
  fees: void 0,
7688
5525
  serializers: void 0,
7689
- ...chain2
5526
+ ...chain
7690
5527
  };
7691
5528
  function extend(base2) {
7692
5529
  return (fnOrExtended) => {
@@ -8176,7 +6013,7 @@ function assert(publicKey, options = {}) {
8176
6013
  function from3(value) {
8177
6014
  const publicKey = (() => {
8178
6015
  if (validate2(value))
8179
- return fromHex4(value);
6016
+ return fromHex3(value);
8180
6017
  if (validate(value))
8181
6018
  return fromBytes2(value);
8182
6019
  const { prefix, x, y } = value;
@@ -8188,9 +6025,9 @@ function from3(value) {
8188
6025
  return publicKey;
8189
6026
  }
8190
6027
  function fromBytes2(publicKey) {
8191
- return fromHex4(fromBytes(publicKey));
6028
+ return fromHex3(fromBytes(publicKey));
8192
6029
  }
8193
- function fromHex4(publicKey) {
6030
+ function fromHex3(publicKey) {
8194
6031
  if (publicKey.length !== 132 && publicKey.length !== 130 && publicKey.length !== 68)
8195
6032
  throw new InvalidSerializedSizeError({ publicKey });
8196
6033
  if (publicKey.length === 130) {
@@ -8219,7 +6056,7 @@ function fromHex4(publicKey) {
8219
6056
  x
8220
6057
  };
8221
6058
  }
8222
- function toHex4(publicKey, options = {}) {
6059
+ function toHex3(publicKey, options = {}) {
8223
6060
  assert(publicKey);
8224
6061
  const { prefix, x, y } = publicKey;
8225
6062
  const { includePrefix = true } = options;
@@ -8346,7 +6183,7 @@ function from4(address, options = {}) {
8346
6183
  return address;
8347
6184
  }
8348
6185
  function fromPublicKey(publicKey, options = {}) {
8349
- const address = keccak2562(`0x${toHex4(publicKey).slice(4)}`).substring(26);
6186
+ const address = keccak2562(`0x${toHex3(publicKey).slice(4)}`).substring(26);
8350
6187
  return from4(`0x${address}`, options);
8351
6188
  }
8352
6189
  function validate3(address, options = {}) {
@@ -9298,7 +7135,7 @@ function from6(value, options) {
9298
7135
  return fromBytes(cursor.bytes);
9299
7136
  return cursor.bytes;
9300
7137
  }
9301
- function fromHex5(hex, options = {}) {
7138
+ function fromHex4(hex, options = {}) {
9302
7139
  const { as = "Hex" } = options;
9303
7140
  return from6(hex, { as });
9304
7141
  }
@@ -9399,9 +7236,9 @@ function assert3(signature, options = {}) {
9399
7236
  throw new InvalidYParityError({ value: signature.yParity });
9400
7237
  }
9401
7238
  function fromBytes3(signature) {
9402
- return fromHex6(fromBytes(signature));
7239
+ return fromHex5(fromBytes(signature));
9403
7240
  }
9404
- function fromHex6(signature) {
7241
+ function fromHex5(signature) {
9405
7242
  if (signature.length !== 130 && signature.length !== 132)
9406
7243
  throw new InvalidSerializedSizeError2({ signature });
9407
7244
  const r = BigInt(slice3(signature, 0, 32));
@@ -9437,7 +7274,7 @@ function extract2(value) {
9437
7274
  function from7(signature) {
9438
7275
  const signature_ = (() => {
9439
7276
  if (typeof signature === "string")
9440
- return fromHex6(signature);
7277
+ return fromHex5(signature);
9441
7278
  if (signature instanceof Uint8Array)
9442
7279
  return fromBytes3(signature);
9443
7280
  if (typeof signature.r === "string")
@@ -9586,7 +7423,7 @@ function getSignPayload(authorization) {
9586
7423
  }
9587
7424
  function hash2(authorization, options = {}) {
9588
7425
  const { presign } = options;
9589
- return keccak2562(concat2("0x05", fromHex5(toTuple2(presign ? {
7426
+ return keccak2562(concat2("0x05", fromHex4(toTuple2(presign ? {
9590
7427
  address: authorization.address,
9591
7428
  chainId: authorization.chainId,
9592
7429
  nonce: authorization.nonce
@@ -10641,9 +8478,9 @@ function serializeSignature({ r, s, to = "hex", v, yParity }) {
10641
8478
 
10642
8479
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/public/verifyHash.js
10643
8480
  async function verifyHash(client, parameters) {
10644
- const { address, chain: chain2 = client.chain, hash: hash3, erc6492VerifierAddress: verifierAddress = parameters.universalSignatureVerifierAddress ?? chain2?.contracts?.erc6492Verifier?.address, multicallAddress = parameters.multicallAddress ?? chain2?.contracts?.multicall3?.address, mode = "auto" } = parameters;
10645
- if (chain2?.verifyHash)
10646
- return await chain2.verifyHash(client, parameters);
8481
+ const { address, chain = client.chain, hash: hash3, erc6492VerifierAddress: verifierAddress = parameters.universalSignatureVerifierAddress ?? chain?.contracts?.erc6492Verifier?.address, multicallAddress = parameters.multicallAddress ?? chain?.contracts?.multicall3?.address, mode = "auto" } = parameters;
8482
+ if (chain?.verifyHash)
8483
+ return await chain.verifyHash(client, parameters);
10647
8484
  const signature = (() => {
10648
8485
  const signature2 = parameters.signature;
10649
8486
  if (isHex(signature2))
@@ -11580,8 +9417,8 @@ function createPublicClient(parameters) {
11580
9417
  }
11581
9418
 
11582
9419
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/wallet/addChain.js
11583
- async function addChain(client, { chain: chain2 }) {
11584
- const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain2;
9420
+ async function addChain(client, { chain }) {
9421
+ const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain;
11585
9422
  await client.request({
11586
9423
  method: "wallet_addEthereumChain",
11587
9424
  params: [
@@ -11691,8 +9528,8 @@ async function requestPermissions(client, permissions) {
11691
9528
 
11692
9529
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/wallet/sendCallsSync.js
11693
9530
  async function sendCallsSync(client, parameters) {
11694
- const { chain: chain2 = client.chain } = parameters;
11695
- const timeout = parameters.timeout ?? Math.max((chain2?.blockTime ?? 0) * 3, 5e3);
9531
+ const { chain = client.chain } = parameters;
9532
+ const timeout = parameters.timeout ?? Math.max((chain?.blockTime ?? 0) * 3, 5e3);
11696
9533
  const result2 = await getAction(client, sendCalls, "sendCalls")(parameters);
11697
9534
  const status = await getAction(client, waitForCallsStatus, "waitForCallsStatus")({
11698
9535
  ...parameters,
@@ -11705,8 +9542,8 @@ async function sendCallsSync(client, parameters) {
11705
9542
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/wallet/sendTransactionSync.js
11706
9543
  var supportsWalletNamespace2 = new LruMap(128);
11707
9544
  async function sendTransactionSync(client, parameters) {
11708
- const { account: account_ = client.account, assertChainId = true, chain: chain2 = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, pollingInterval, throwOnReceiptRevert, type, value, ...rest } = parameters;
11709
- const timeout = parameters.timeout ?? Math.max((chain2?.blockTime ?? 0) * 3, 5e3);
9545
+ const { account: account_ = client.account, assertChainId = true, chain = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, pollingInterval, throwOnReceiptRevert, type, value, ...rest } = parameters;
9546
+ const timeout = parameters.timeout ?? Math.max((chain?.blockTime ?? 0) * 3, 5e3);
11710
9547
  if (typeof account_ === "undefined")
11711
9548
  throw new AccountNotFoundError2({
11712
9549
  docsPath: "/docs/actions/wallet/sendTransactionSync"
@@ -11729,12 +9566,12 @@ async function sendTransactionSync(client, parameters) {
11729
9566
  })();
11730
9567
  if (account?.type === "json-rpc" || account === null) {
11731
9568
  let chainId;
11732
- if (chain2 !== null) {
9569
+ if (chain !== null) {
11733
9570
  chainId = await getAction(client, getChainId, "getChainId")({});
11734
9571
  if (assertChainId)
11735
9572
  assertCurrentChain({
11736
9573
  currentChainId: chainId,
11737
- chain: chain2
9574
+ chain
11738
9575
  });
11739
9576
  }
11740
9577
  const chainFormat = client.chain?.formatters?.transactionRequest?.format;
@@ -11805,7 +9642,7 @@ async function sendTransactionSync(client, parameters) {
11805
9642
  accessList,
11806
9643
  authorizationList,
11807
9644
  blobs,
11808
- chain: chain2,
9645
+ chain,
11809
9646
  data: data ? concat([data, dataSuffix ?? "0x"]) : data,
11810
9647
  gas,
11811
9648
  gasPrice,
@@ -11820,7 +9657,7 @@ async function sendTransactionSync(client, parameters) {
11820
9657
  ...rest,
11821
9658
  to
11822
9659
  });
11823
- const serializer = chain2?.serializers?.transaction;
9660
+ const serializer = chain?.serializers?.transaction;
11824
9661
  const serializedTransaction = await account.signTransaction(request, {
11825
9662
  serializer
11826
9663
  });
@@ -11907,7 +9744,7 @@ async function signMessage2(client, { account: account_ = client.account, messag
11907
9744
 
11908
9745
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/actions/wallet/signTransaction.js
11909
9746
  async function signTransaction(client, parameters) {
11910
- const { account: account_ = client.account, chain: chain2 = client.chain, ...transaction } = parameters;
9747
+ const { account: account_ = client.account, chain = client.chain, ...transaction } = parameters;
11911
9748
  if (!account_)
11912
9749
  throw new AccountNotFoundError2({
11913
9750
  docsPath: "/docs/actions/wallet/signTransaction"
@@ -11918,12 +9755,12 @@ async function signTransaction(client, parameters) {
11918
9755
  ...parameters
11919
9756
  });
11920
9757
  const chainId = await getAction(client, getChainId, "getChainId")({});
11921
- if (chain2 !== null)
9758
+ if (chain !== null)
11922
9759
  assertCurrentChain({
11923
9760
  currentChainId: chainId,
11924
- chain: chain2
9761
+ chain
11925
9762
  });
11926
- const formatters2 = chain2?.formatters || client.chain?.formatters;
9763
+ const formatters2 = chain?.formatters || client.chain?.formatters;
11927
9764
  const format = formatters2?.transactionRequest?.format || formatTransactionRequest;
11928
9765
  if (account.signTransaction)
11929
9766
  return account.signTransaction({
@@ -12072,11 +9909,11 @@ var UrlRequiredError = class extends BaseError {
12072
9909
  // ../../node_modules/.pnpm/viem@2.47.6_typescript@6.0.2/node_modules/viem/_esm/clients/transports/http.js
12073
9910
  function http(url, config = {}) {
12074
9911
  const { batch, fetchFn, fetchOptions, key = "http", methods, name = "HTTP JSON-RPC", onFetchRequest, onFetchResponse, retryDelay, raw } = config;
12075
- return ({ chain: chain2, retryCount: retryCount_, timeout: timeout_ }) => {
9912
+ return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {
12076
9913
  const { batchSize = 1e3, wait: wait2 = 0 } = typeof batch === "object" ? batch : {};
12077
9914
  const retryCount = config.retryCount ?? retryCount_;
12078
9915
  const timeout = timeout_ ?? config.timeout ?? 1e4;
12079
- const url_ = url || chain2?.rpcUrls.default.http[0];
9916
+ const url_ = url || chain?.rpcUrls.default.http[0];
12080
9917
  if (!url_)
12081
9918
  throw new UrlRequiredError();
12082
9919
  const rpcClient = getHttpRpcClient(url_, {
@@ -12637,7 +10474,7 @@ var sepolia = /* @__PURE__ */ defineChain({
12637
10474
  });
12638
10475
 
12639
10476
  // ../../packages/allset-sdk/dist/index.js
12640
- import { Schema as Schema21 } from "effect";
10477
+ import { Schema as Schema5 } from "effect";
12641
10478
  function fastAddressToBytes(address) {
12642
10479
  try {
12643
10480
  return fromFastAddress(address);
@@ -12646,7 +10483,7 @@ function fastAddressToBytes(address) {
12646
10483
  }
12647
10484
  }
12648
10485
  function fastAddressToBytes32(address) {
12649
- return toHex3(fastAddressToBytes(address));
10486
+ return toHex2(fastAddressToBytes(address));
12650
10487
  }
12651
10488
  var INTENT_CLAIM_ABI_PARAMS = [
12652
10489
  {
@@ -12971,26 +10808,26 @@ var CHAIN_MAP = {
12971
10808
  8453: base
12972
10809
  };
12973
10810
  function createEvmExecutor(account, rpcUrl, chainOrId) {
12974
- const chain2 = typeof chainOrId === "number" ? resolveChain(chainOrId) : chainOrId;
10811
+ const chain = typeof chainOrId === "number" ? resolveChain(chainOrId) : chainOrId;
12975
10812
  const walletClient = createWalletClient({
12976
10813
  account,
12977
- chain: chain2,
10814
+ chain,
12978
10815
  transport: http(rpcUrl)
12979
10816
  });
12980
10817
  const publicClient = createPublicClient({
12981
- chain: chain2,
10818
+ chain,
12982
10819
  transport: http(rpcUrl)
12983
10820
  });
12984
10821
  return { walletClient, publicClient };
12985
10822
  }
12986
10823
  function resolveChain(chainId) {
12987
- const chain2 = CHAIN_MAP[chainId];
12988
- if (!chain2) {
10824
+ const chain = CHAIN_MAP[chainId];
10825
+ if (!chain) {
12989
10826
  throw new Error(
12990
10827
  `Unsupported EVM chain ID: ${chainId}. Supported: ${Object.keys(CHAIN_MAP).join(", ")}. Pass a viem Chain object directly to avoid this restriction.`
12991
10828
  );
12992
10829
  }
12993
- return chain2;
10830
+ return chain;
12994
10831
  }
12995
10832
  async function getEvmErc20Balance(rpcUrl, tokenAddress, ownerAddress) {
12996
10833
  const client = createPublicClient({ transport: http(rpcUrl) });
@@ -13173,7 +11010,7 @@ async function approveErc20(clients, token, spender, amount) {
13173
11010
  }
13174
11011
  }
13175
11012
  async function evmSign(certificate, crossSignUrl) {
13176
- const wireFormat = Schema21.encodeSync(TransactionCertificateFromRpc)(
11013
+ const wireFormat = Schema5.encodeSync(TransactionCertificateFromRpc)(
13177
11014
  certificate
13178
11015
  );
13179
11016
  const serialized = bigIntToNumber(wireFormat);
@@ -13536,7 +11373,7 @@ var FastRpcLive = Layer3.effect(
13536
11373
 
13537
11374
  // ../../packages/x402-client/dist/bridge.js
13538
11375
  async function getFastBalance(wallet, options) {
13539
- const provider = new FastProvider({ url: options.rpcUrl });
11376
+ const provider = new FastProvider({ url: options.rpcUrl, networkId: options.networkId });
13540
11377
  const signer = new Signer(wallet.privateKey);
13541
11378
  const publicKey = await signer.getPublicKey();
13542
11379
  try {
@@ -13550,7 +11387,7 @@ async function getFastBalance(wallet, options) {
13550
11387
  if (!tokenBalance)
13551
11388
  return 0n;
13552
11389
  for (const [tokenIdBytes, balance] of tokenBalance) {
13553
- const normalizedId = toHex3(tokenIdBytes).replace(/^0x/, "");
11390
+ const normalizedId = toHex2(tokenIdBytes).replace(/^0x/, "");
13554
11391
  if (normalizedId === options.tokenId) {
13555
11392
  return balance;
13556
11393
  }
@@ -13573,7 +11410,7 @@ async function bridgeFastusdcToUsdc(params) {
13573
11410
  log(` From: ${fastWallet.address}`);
13574
11411
  log(` To: ${evmReceiverAddress}`);
13575
11412
  try {
13576
- const provider = new FastProvider({ url: rpcUrl });
11413
+ const provider = new FastProvider({ url: rpcUrl, networkId });
13577
11414
  const signer = new Signer(fastWallet.privateKey);
13578
11415
  const publicKey = await signer.getPublicKey();
13579
11416
  const derivedAddress = toFastAddress(publicKey);
@@ -13606,7 +11443,7 @@ async function bridgeFastusdcToUsdc(params) {
13606
11443
  }
13607
11444
 
13608
11445
  // ../../packages/x402-client/dist/fast.js
13609
- import { Schema as Schema24 } from "effect";
11446
+ import { Schema as Schema6 } from "effect";
13610
11447
  var fastProviders = {};
13611
11448
  function getFastProvider(url) {
13612
11449
  if (!fastProviders[url]) {
@@ -13649,7 +11486,14 @@ function stringifyPaymentPayload(data) {
13649
11486
  return serialized;
13650
11487
  }
13651
11488
  function resolveNetworkId(network2) {
13652
- return network2 === "fast-mainnet" ? "fast:mainnet" : "fast:testnet";
11489
+ switch (network2) {
11490
+ case "fast-mainnet":
11491
+ return "fast:mainnet";
11492
+ case "fast-testnet":
11493
+ return "fast:testnet";
11494
+ default:
11495
+ throw new Error(`Unknown Fast network: "${network2}"`);
11496
+ }
13653
11497
  }
13654
11498
  async function handleFastPayment(url, method, customHeaders, requestBody, paymentRequired, fastReq, wallet, verbose = false, logs = []) {
13655
11499
  const log = (msg) => {
@@ -13687,12 +11531,12 @@ async function handleFastPayment(url, method, customHeaders, requestBody, paymen
13687
11531
  let tokenId;
13688
11532
  if (fastReq.asset) {
13689
11533
  const assetHex = fastReq.asset.startsWith("0x") ? fastReq.asset.slice(2) : fastReq.asset;
13690
- tokenId = fromHex3(assetHex);
11534
+ tokenId = fromHex2(assetHex);
13691
11535
  log(` Token: ${fastReq.asset} (from payment requirement)`);
13692
11536
  } else {
13693
11537
  throw new Error("No token asset specified in payment requirement");
13694
11538
  }
13695
- const recipientBytes = fastReq.payTo.startsWith("fast1") ? fromFastAddress(fastReq.payTo) : fromHex3(fastReq.payTo);
11539
+ const recipientBytes = fastReq.payTo.startsWith("fast1") ? fromFastAddress(fastReq.payTo) : fromHex2(fastReq.payTo);
13696
11540
  const amountHuman = toHuman(fastReq.maxAmountRequired, 6);
13697
11541
  log(`[Fast] Building transaction via TransactionBuilder...`);
13698
11542
  log(` Amount: ${fastReq.maxAmountRequired} raw \u2192 ${amountHuman} USDC`);
@@ -13717,7 +11561,7 @@ async function handleFastPayment(url, method, customHeaders, requestBody, paymen
13717
11561
  }
13718
11562
  log(` Transaction complete in ${Date.now() - txStartTime}ms`);
13719
11563
  const certificate = submitResult.value;
13720
- const bcsInput = Schema24.encodeSync(VersionedTransactionFromBcs)(certificate.envelope.transaction);
11564
+ const bcsInput = Schema6.encodeSync(VersionedTransactionFromBcs)(certificate.envelope.transaction);
13721
11565
  const txHash = await hashHex2(bcs_layout_exports.VersionedTransaction, bcsInput);
13722
11566
  log(` txHash: ${txHash}`);
13723
11567
  log(`[Fast] Building x402 payment payload...`);
@@ -13835,7 +11679,8 @@ async function handleEvmPayment(url, method, customHeaders, requestBody, payment
13835
11679
  log(`[EVM] Checking Fast USDC balance...`);
13836
11680
  const fastBalance = await getFastBalance(fastWallet, {
13837
11681
  rpcUrl: bridgeConfig.rpcUrl,
13838
- tokenId: bridgeConfig.tokenFastTokenId
11682
+ tokenId: bridgeConfig.tokenFastTokenId,
11683
+ networkId: bridgeConfig.networkId
13839
11684
  });
13840
11685
  log(` Fast USDC balance: ${Number(fastBalance) / 1e6}`);
13841
11686
  const shortfall = requiredAmount - currentBalance;
@@ -14656,13 +12501,13 @@ function validateObject(object2, fields = {}, optFields = {}) {
14656
12501
  iter(optFields, true);
14657
12502
  }
14658
12503
  function memoized(fn) {
14659
- const map2 = /* @__PURE__ */ new WeakMap();
12504
+ const map = /* @__PURE__ */ new WeakMap();
14660
12505
  return (arg, ...args) => {
14661
- const val = map2.get(arg);
12506
+ const val = map.get(arg);
14662
12507
  if (val !== void 0)
14663
12508
  return val;
14664
12509
  const computed = fn(arg, ...args);
14665
- map2.set(arg, computed);
12510
+ map.set(arg, computed);
14666
12511
  return computed;
14667
12512
  };
14668
12513
  }
@@ -14835,9 +12680,9 @@ function validateField(field) {
14835
12680
  BYTES: "number",
14836
12681
  BITS: "number"
14837
12682
  };
14838
- const opts = FIELD_FIELDS.reduce((map2, val) => {
14839
- map2[val] = "function";
14840
- return map2;
12683
+ const opts = FIELD_FIELDS.reduce((map, val) => {
12684
+ map[val] = "function";
12685
+ return map;
14841
12686
  }, initial);
14842
12687
  validateObject(field, opts);
14843
12688
  return field;
@@ -14849,15 +12694,15 @@ function FpPow(Fp, num, power) {
14849
12694
  return Fp.ONE;
14850
12695
  if (power === _1n3)
14851
12696
  return num;
14852
- let p4 = Fp.ONE;
12697
+ let p = Fp.ONE;
14853
12698
  let d = num;
14854
12699
  while (power > _0n3) {
14855
12700
  if (power & _1n3)
14856
- p4 = Fp.mul(p4, d);
12701
+ p = Fp.mul(p, d);
14857
12702
  d = Fp.sqr(d);
14858
12703
  power >>= _1n3;
14859
12704
  }
14860
- return p4;
12705
+ return p;
14861
12706
  }
14862
12707
  function FpInvertBatch(Fp, nums, passZero = false) {
14863
12708
  const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : void 0);
@@ -15061,8 +12906,8 @@ function negateCt(condition, item) {
15061
12906
  return condition ? neg : item;
15062
12907
  }
15063
12908
  function normalizeZ(c, points) {
15064
- const invertedZs = FpInvertBatch(c.Fp, points.map((p4) => p4.Z));
15065
- return points.map((p4, i) => c.fromAffine(p4.toAffine(invertedZs[i])));
12909
+ const invertedZs = FpInvertBatch(c.Fp, points.map((p) => p.Z));
12910
+ return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i])));
15066
12911
  }
15067
12912
  function validateW(W2, bits) {
15068
12913
  if (!Number.isSafeInteger(W2) || W2 <= 0 || W2 > bits)
@@ -15115,15 +12960,15 @@ var wNAF2 = class {
15115
12960
  this.bits = bits;
15116
12961
  }
15117
12962
  // non-const time multiplication ladder
15118
- _unsafeLadder(elm, n, p4 = this.ZERO) {
12963
+ _unsafeLadder(elm, n, p = this.ZERO) {
15119
12964
  let d = elm;
15120
12965
  while (n > _0n4) {
15121
12966
  if (n & _1n4)
15122
- p4 = p4.add(d);
12967
+ p = p.add(d);
15123
12968
  d = d.double();
15124
12969
  n >>= _1n4;
15125
12970
  }
15126
- return p4;
12971
+ return p;
15127
12972
  }
15128
12973
  /**
15129
12974
  * Creates a wNAF precomputation window. Used for caching.
@@ -15140,16 +12985,16 @@ var wNAF2 = class {
15140
12985
  precomputeWindow(point, W2) {
15141
12986
  const { windows, windowSize } = calcWOpts(W2, this.bits);
15142
12987
  const points = [];
15143
- let p4 = point;
15144
- let base2 = p4;
12988
+ let p = point;
12989
+ let base2 = p;
15145
12990
  for (let window = 0; window < windows; window++) {
15146
- base2 = p4;
12991
+ base2 = p;
15147
12992
  points.push(base2);
15148
12993
  for (let i = 1; i < windowSize; i++) {
15149
- base2 = base2.add(p4);
12994
+ base2 = base2.add(p);
15150
12995
  points.push(base2);
15151
12996
  }
15152
- p4 = base2.double();
12997
+ p = base2.double();
15153
12998
  }
15154
12999
  return points;
15155
13000
  }
@@ -15162,7 +13007,7 @@ var wNAF2 = class {
15162
13007
  wNAF(W2, precomputes, n) {
15163
13008
  if (!this.Fn.isValid(n))
15164
13009
  throw new Error("invalid scalar");
15165
- let p4 = this.ZERO;
13010
+ let p = this.ZERO;
15166
13011
  let f = this.BASE;
15167
13012
  const wo = calcWOpts(W2, this.bits);
15168
13013
  for (let window = 0; window < wo.windows; window++) {
@@ -15171,11 +13016,11 @@ var wNAF2 = class {
15171
13016
  if (isZero) {
15172
13017
  f = f.add(negateCt(isNegF, precomputes[offsetF]));
15173
13018
  } else {
15174
- p4 = p4.add(negateCt(isNeg, precomputes[offset]));
13019
+ p = p.add(negateCt(isNeg, precomputes[offset]));
15175
13020
  }
15176
13021
  }
15177
13022
  assert0(n);
15178
- return { p: p4, f };
13023
+ return { p, f };
15179
13024
  }
15180
13025
  /**
15181
13026
  * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
@@ -15236,17 +13081,17 @@ var wNAF2 = class {
15236
13081
  function mulEndoUnsafe(Point2, point, k1, k2) {
15237
13082
  let acc = point;
15238
13083
  let p1 = Point2.ZERO;
15239
- let p22 = Point2.ZERO;
13084
+ let p2 = Point2.ZERO;
15240
13085
  while (k1 > _0n4 || k2 > _0n4) {
15241
13086
  if (k1 & _1n4)
15242
13087
  p1 = p1.add(acc);
15243
13088
  if (k2 & _1n4)
15244
- p22 = p22.add(acc);
13089
+ p2 = p2.add(acc);
15245
13090
  acc = acc.double();
15246
13091
  k1 >>= _1n4;
15247
13092
  k2 >>= _1n4;
15248
13093
  }
15249
- return { p1, p2: p22 };
13094
+ return { p1, p2 };
15250
13095
  }
15251
13096
  function createField(order, field, isLE3) {
15252
13097
  if (field) {
@@ -15263,18 +13108,18 @@ function createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
15263
13108
  FpFnLE = type === "edwards";
15264
13109
  if (!CURVE || typeof CURVE !== "object")
15265
13110
  throw new Error(`expected valid ${type} CURVE object`);
15266
- for (const p4 of ["p", "n", "h"]) {
15267
- const val = CURVE[p4];
13111
+ for (const p of ["p", "n", "h"]) {
13112
+ const val = CURVE[p];
15268
13113
  if (!(typeof val === "bigint" && val > _0n4))
15269
- throw new Error(`CURVE.${p4} must be positive bigint`);
13114
+ throw new Error(`CURVE.${p} must be positive bigint`);
15270
13115
  }
15271
13116
  const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);
15272
13117
  const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE);
15273
13118
  const _b = type === "weierstrass" ? "b" : "d";
15274
13119
  const params = ["Gx", "Gy", "a", _b];
15275
- for (const p4 of params) {
15276
- if (!Fp.isValid(CURVE[p4]))
15277
- throw new Error(`CURVE.${p4} must be valid field element of CURVE.Fp`);
13120
+ for (const p of params) {
13121
+ if (!Fp.isValid(CURVE[p]))
13122
+ throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);
15278
13123
  }
15279
13124
  CURVE = Object.freeze(Object.assign({}, CURVE));
15280
13125
  return { CURVE, Fp, Fn };
@@ -15606,11 +13451,11 @@ function weierstrass(params, extraOpts = {}) {
15606
13451
  throw new Error("no endo");
15607
13452
  return _splitEndoScalar(k, endo.basises, Fn.ORDER);
15608
13453
  }
15609
- const toAffineMemo = memoized((p4, iz) => {
15610
- const { X, Y, Z } = p4;
13454
+ const toAffineMemo = memoized((p, iz) => {
13455
+ const { X, Y, Z } = p;
15611
13456
  if (Fp.eql(Z, Fp.ONE))
15612
13457
  return { x: X, y: Y };
15613
- const is0 = p4.is0();
13458
+ const is0 = p.is0();
15614
13459
  if (iz == null)
15615
13460
  iz = is0 ? Fp.ONE : Fp.inv(Z);
15616
13461
  const x = Fp.mul(X, iz);
@@ -15622,18 +13467,18 @@ function weierstrass(params, extraOpts = {}) {
15622
13467
  throw new Error("invZ was invalid");
15623
13468
  return { x, y };
15624
13469
  });
15625
- const assertValidMemo = memoized((p4) => {
15626
- if (p4.is0()) {
15627
- if (extraOpts.allowInfinityPoint && !Fp.is0(p4.Y))
13470
+ const assertValidMemo = memoized((p) => {
13471
+ if (p.is0()) {
13472
+ if (extraOpts.allowInfinityPoint && !Fp.is0(p.Y))
15628
13473
  return;
15629
13474
  throw new Error("bad point: ZERO");
15630
13475
  }
15631
- const { x, y } = p4.toAffine();
13476
+ const { x, y } = p.toAffine();
15632
13477
  if (!Fp.isValid(x) || !Fp.isValid(y))
15633
13478
  throw new Error("bad point: x or y not field elements");
15634
13479
  if (!isValidXY(x, y))
15635
13480
  throw new Error("bad point: equation left != right");
15636
- if (!p4.isTorsionFree())
13481
+ if (!p.isTorsionFree())
15637
13482
  throw new Error("bad point: not in prime-order subgroup");
15638
13483
  return true;
15639
13484
  });
@@ -15667,11 +13512,11 @@ function weierstrass(params, extraOpts = {}) {
15667
13512
  return CURVE;
15668
13513
  }
15669
13514
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
15670
- static fromAffine(p4) {
15671
- const { x, y } = p4 || {};
15672
- if (!p4 || !Fp.isValid(x) || !Fp.isValid(y))
13515
+ static fromAffine(p) {
13516
+ const { x, y } = p || {};
13517
+ if (!p || !Fp.isValid(x) || !Fp.isValid(y))
15673
13518
  throw new Error("invalid affine point");
15674
- if (p4 instanceof Point2)
13519
+ if (p instanceof Point2)
15675
13520
  throw new Error("projective point not allowed");
15676
13521
  if (Fp.is0(x) && Fp.is0(y))
15677
13522
  return Point2.ZERO;
@@ -15842,7 +13687,7 @@ function weierstrass(params, extraOpts = {}) {
15842
13687
  if (!Fn.isValidNot0(scalar))
15843
13688
  throw new Error("invalid scalar: out of range");
15844
13689
  let point, fake;
15845
- const mul3 = (n) => wnaf.cached(this, n, (p4) => normalizeZ(Point2, p4));
13690
+ const mul3 = (n) => wnaf.cached(this, n, (p) => normalizeZ(Point2, p));
15846
13691
  if (endo2) {
15847
13692
  const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(scalar);
15848
13693
  const { p: k1p, f: k1f } = mul3(k1);
@@ -15850,8 +13695,8 @@ function weierstrass(params, extraOpts = {}) {
15850
13695
  fake = k1f.add(k2f);
15851
13696
  point = finishEndo(endo2.beta, k1p, k2p, k1neg, k2neg);
15852
13697
  } else {
15853
- const { p: p4, f } = mul3(scalar);
15854
- point = p4;
13698
+ const { p, f } = mul3(scalar);
13699
+ point = p;
15855
13700
  fake = f;
15856
13701
  }
15857
13702
  return normalizeZ(Point2, [point, fake])[0];
@@ -15863,21 +13708,21 @@ function weierstrass(params, extraOpts = {}) {
15863
13708
  */
15864
13709
  multiplyUnsafe(sc) {
15865
13710
  const { endo: endo2 } = extraOpts;
15866
- const p4 = this;
13711
+ const p = this;
15867
13712
  if (!Fn.isValid(sc))
15868
13713
  throw new Error("invalid scalar: out of range");
15869
- if (sc === _0n5 || p4.is0())
13714
+ if (sc === _0n5 || p.is0())
15870
13715
  return Point2.ZERO;
15871
13716
  if (sc === _1n5)
15872
- return p4;
13717
+ return p;
15873
13718
  if (wnaf.hasCache(this))
15874
13719
  return this.multiply(sc);
15875
13720
  if (endo2) {
15876
13721
  const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc);
15877
- const { p1, p2: p22 } = mulEndoUnsafe(Point2, p4, k1, k2);
15878
- return finishEndo(endo2.beta, p1, p22, k1neg, k2neg);
13722
+ const { p1, p2 } = mulEndoUnsafe(Point2, p, k1, k2);
13723
+ return finishEndo(endo2.beta, p1, p2, k1neg, k2neg);
15879
13724
  } else {
15880
- return wnaf.unsafe(p4, sc);
13725
+ return wnaf.unsafe(p, sc);
15881
13726
  }
15882
13727
  }
15883
13728
  /**
@@ -16037,7 +13882,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16037
13882
  const sizer = format === "compact" ? size5 : format === "recovered" ? size5 + 1 : void 0;
16038
13883
  return abytes(bytes, sizer);
16039
13884
  }
16040
- class Signature3 {
13885
+ class Signature {
16041
13886
  r;
16042
13887
  s;
16043
13888
  recovery;
@@ -16057,7 +13902,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16057
13902
  let recid;
16058
13903
  if (format === "der") {
16059
13904
  const { r: r2, s: s2 } = DER.toSig(abytes(bytes));
16060
- return new Signature3(r2, s2);
13905
+ return new Signature(r2, s2);
16061
13906
  }
16062
13907
  if (format === "recovered") {
16063
13908
  recid = bytes[0];
@@ -16067,7 +13912,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16067
13912
  const L2 = lengths.signature / 2;
16068
13913
  const r = bytes.subarray(0, L2);
16069
13914
  const s = bytes.subarray(L2, L2 * 2);
16070
- return new Signature3(Fn.fromBytes(r), Fn.fromBytes(s), recid);
13915
+ return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid);
16071
13916
  }
16072
13917
  static fromHex(hex, format) {
16073
13918
  return this.fromBytes(hexToBytes2(hex), format);
@@ -16079,7 +13924,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16079
13924
  return recovery;
16080
13925
  }
16081
13926
  addRecoveryBit(recovery) {
16082
- return new Signature3(this.r, this.s, recovery);
13927
+ return new Signature(this.r, this.s, recovery);
16083
13928
  }
16084
13929
  recoverPublicKey(messageHash) {
16085
13930
  const { r, s } = this;
@@ -16171,7 +14016,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16171
14016
  normS = Fn.neg(s);
16172
14017
  recovery ^= 1;
16173
14018
  }
16174
- return new Signature3(r, normS, hasLargeCofactor ? void 0 : recovery);
14019
+ return new Signature(r, normS, hasLargeCofactor ? void 0 : recovery);
16175
14020
  }
16176
14021
  return { seed, k2sig };
16177
14022
  }
@@ -16186,12 +14031,12 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16186
14031
  publicKey = abytes(publicKey, void 0, "publicKey");
16187
14032
  message2 = validateMsgAndHash(message2, prehash);
16188
14033
  if (!isBytes(signature)) {
16189
- const end = signature instanceof Signature3 ? ", use sig.toBytes()" : "";
14034
+ const end = signature instanceof Signature ? ", use sig.toBytes()" : "";
16190
14035
  throw new Error("verify expects Uint8Array signature" + end);
16191
14036
  }
16192
14037
  validateSigLength(signature, format);
16193
14038
  try {
16194
- const sig = Signature3.fromBytes(signature, format);
14039
+ const sig = Signature.fromBytes(signature, format);
16195
14040
  const P2 = Point2.fromBytes(publicKey);
16196
14041
  if (lowS && sig.hasHighS())
16197
14042
  return false;
@@ -16212,7 +14057,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16212
14057
  function recoverPublicKey3(signature, message2, opts = {}) {
16213
14058
  const { prehash } = validateSigOpts(opts, defaultSigOpts);
16214
14059
  message2 = validateMsgAndHash(message2, prehash);
16215
- return Signature3.fromBytes(signature, "recovered").recoverPublicKey(message2).toBytes();
14060
+ return Signature.fromBytes(signature, "recovered").recoverPublicKey(message2).toBytes();
16216
14061
  }
16217
14062
  return Object.freeze({
16218
14063
  keygen,
@@ -16224,7 +14069,7 @@ function ecdsa(Point2, hash3, ecdsaOpts = {}) {
16224
14069
  sign: sign2,
16225
14070
  verify: verify2,
16226
14071
  recoverPublicKey: recoverPublicKey3,
16227
- Signature: Signature3,
14072
+ Signature,
16228
14073
  hash: hash3
16229
14074
  });
16230
14075
  }
@@ -16284,11 +14129,11 @@ import { Effect as Effect12, Option as Option3 } from "effect";
16284
14129
  import { timingSafeEqual } from "crypto";
16285
14130
 
16286
14131
  // ../../node_modules/.pnpm/@noble+ciphers@1.3.0/node_modules/@noble/ciphers/esm/utils.js
16287
- function isBytes4(a) {
14132
+ function isBytes3(a) {
16288
14133
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
16289
14134
  }
16290
14135
  function abytes3(b, ...lengths) {
16291
- if (!isBytes4(b))
14136
+ if (!isBytes3(b))
16292
14137
  throw new Error("Uint8Array expected");
16293
14138
  if (lengths.length > 0 && !lengths.includes(b.length))
16294
14139
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
@@ -16432,10 +14277,10 @@ function genTtable(sbox2, fn) {
16432
14277
  }
16433
14278
  var tableEncoding = /* @__PURE__ */ genTtable(sbox, (s) => mul(s, 3) << 24 | s << 16 | s << 8 | mul(s, 2));
16434
14279
  var xPowers = /* @__PURE__ */ (() => {
16435
- const p4 = new Uint8Array(16);
14280
+ const p = new Uint8Array(16);
16436
14281
  for (let i = 0, x = 1; i < 16; i++, x = mul2(x))
16437
- p4[i] = x;
16438
- return p4;
14282
+ p[i] = x;
14283
+ return p;
16439
14284
  })();
16440
14285
  function expandKeyLE(key) {
16441
14286
  abytes3(key);
@@ -16668,10 +14513,10 @@ function scryptInit(password, salt, _opts) {
16668
14513
  asyncTick: 10,
16669
14514
  maxmem: 1024 ** 3 + 1024
16670
14515
  }, _opts);
16671
- const { N: N2, r, p: p4, dkLen, asyncTick, maxmem, onProgress } = opts;
14516
+ const { N: N2, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;
16672
14517
  anumber(N2, "N");
16673
14518
  anumber(r, "r");
16674
- anumber(p4, "p");
14519
+ anumber(p, "p");
16675
14520
  anumber(dkLen, "dkLen");
16676
14521
  anumber(asyncTick, "asyncTick");
16677
14522
  anumber(maxmem, "maxmem");
@@ -16682,21 +14527,21 @@ function scryptInit(password, salt, _opts) {
16682
14527
  const pow32 = Math.pow(2, 32);
16683
14528
  if (N2 <= 1 || (N2 & N2 - 1) !== 0 || N2 > pow32)
16684
14529
  throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');
16685
- if (p4 < 1 || p4 > (pow32 - 1) * 32 / blockSize)
14530
+ if (p < 1 || p > (pow32 - 1) * 32 / blockSize)
16686
14531
  throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');
16687
14532
  if (dkLen < 1 || dkLen > (pow32 - 1) * 32)
16688
14533
  throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');
16689
- const memUsed = blockSize * (N2 + p4);
14534
+ const memUsed = blockSize * (N2 + p);
16690
14535
  if (memUsed > maxmem)
16691
14536
  throw new Error('"maxmem" limit was hit, expected 128*r*(N+p) <= "maxmem"=' + maxmem);
16692
- const B = pbkdf2(sha2564, password, salt, { c: 1, dkLen: blockSize * p4 });
14537
+ const B = pbkdf2(sha2564, password, salt, { c: 1, dkLen: blockSize * p });
16693
14538
  const B32 = u32(B);
16694
14539
  const V = u32(new Uint8Array(blockSize * N2));
16695
14540
  const tmp = u32(new Uint8Array(blockSize));
16696
14541
  let blockMixCb = () => {
16697
14542
  };
16698
14543
  if (onProgress) {
16699
- const totalBlockMix = 2 * N2 * p4;
14544
+ const totalBlockMix = 2 * N2 * p;
16700
14545
  const callbackPer = Math.max(Math.floor(totalBlockMix / 1e4), 1);
16701
14546
  let blockMixCnt = 0;
16702
14547
  blockMixCb = () => {
@@ -16705,7 +14550,7 @@ function scryptInit(password, salt, _opts) {
16705
14550
  onProgress(blockMixCnt / totalBlockMix);
16706
14551
  };
16707
14552
  }
16708
- return { N: N2, r, p: p4, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
14553
+ return { N: N2, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
16709
14554
  }
16710
14555
  function scryptOutput(password, dkLen, B, V, tmp) {
16711
14556
  const res = pbkdf2(sha2564, password, B, { c: 1, dkLen });
@@ -16713,9 +14558,9 @@ function scryptOutput(password, dkLen, B, V, tmp) {
16713
14558
  return res;
16714
14559
  }
16715
14560
  async function scryptAsync(password, salt, opts) {
16716
- const { N: N2, r, p: p4, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);
14561
+ const { N: N2, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);
16717
14562
  swap32IfBE(B32);
16718
- for (let pi = 0; pi < p4; pi++) {
14563
+ for (let pi = 0; pi < p; pi++) {
16719
14564
  const Pi = blockSize32 * pi;
16720
14565
  for (let i = 0; i < blockSize32; i++)
16721
14566
  V[i] = B32[Pi + i];
@@ -16761,10 +14606,10 @@ var encryptSeed = async (seed, password) => {
16761
14606
  const mac = computeMac(derivedKey, ciphertext);
16762
14607
  const blob = {
16763
14608
  v: 1,
16764
- salt: toHex3(salt),
16765
- iv: toHex3(iv),
16766
- mac: toHex3(mac),
16767
- ct: toHex3(ciphertext),
14609
+ salt: toHex2(salt),
14610
+ iv: toHex2(iv),
14611
+ mac: toHex2(mac),
14612
+ ct: toHex2(ciphertext),
16768
14613
  kdf: { n: SCRYPT_N, r: SCRYPT_R, p: SCRYPT_P }
16769
14614
  };
16770
14615
  return encryptJson(blob);
@@ -16775,10 +14620,10 @@ var storeSeed = async (seed, password) => {
16775
14620
  };
16776
14621
  var decryptSeed = async (blob, password) => {
16777
14622
  const parsed2 = decryptJson(blob);
16778
- const salt = fromHex3(parsed2.salt);
16779
- const iv = fromHex3(parsed2.iv);
16780
- const ciphertext = fromHex3(parsed2.ct);
16781
- const storedMac = fromHex3(parsed2.mac);
14623
+ const salt = fromHex2(parsed2.salt);
14624
+ const iv = fromHex2(parsed2.iv);
14625
+ const ciphertext = fromHex2(parsed2.ct);
14626
+ const storedMac = fromHex2(parsed2.mac);
16782
14627
  const derivedKey = await scryptAsync(encodePassword(password), salt, {
16783
14628
  N: parsed2.kdf.n,
16784
14629
  r: parsed2.kdf.r,
@@ -16812,7 +14657,7 @@ var rowToInfo = (row) => ({
16812
14657
  var deriveEvmAddress = (seed) => {
16813
14658
  const pubkey = secp256k12.getPublicKey(seed, false);
16814
14659
  const hash3 = keccak_2562(pubkey.slice(1));
16815
- return toHex3(hash3.slice(-20));
14660
+ return toHex2(hash3.slice(-20));
16816
14661
  };
16817
14662
  var getAccountByName = (db, name) => db.select().from(accounts).where(eq(accounts.name, name)).get();
16818
14663
  var getDefaultAccount = (db) => db.select().from(accounts).where(eq(accounts.isDefault, true)).get();
@@ -17122,41 +14967,41 @@ var runHandler = (opts, program) => {
17122
14967
  import { merge, object, or as or2 } from "@optique/core/constructs";
17123
14968
  import { message } from "@optique/core/message";
17124
14969
  import { multiple, optional, withDefault } from "@optique/core/modifiers";
17125
- import { argument, command, constant, option as option2, passThrough } from "@optique/core/primitives";
14970
+ import { argument, command, constant, option, passThrough } from "@optique/core/primitives";
17126
14971
  import { integer, string } from "@optique/core/valueparser";
17127
14972
  var globalPreParser = object({
17128
- json: withDefault(option2("--json"), false),
17129
- help: withDefault(option2("--help"), false),
17130
- version: withDefault(option2("--version"), false),
14973
+ json: withDefault(option("--json"), false),
14974
+ help: withDefault(option("--help"), false),
14975
+ version: withDefault(option("--version"), false),
17131
14976
  _rest: passThrough({ format: "greedy" })
17132
14977
  });
17133
14978
  var globalOptions = object({
17134
14979
  json: withDefault(
17135
- option2("--json", { description: message`Emit machine-parseable JSON to stdout` }),
14980
+ option("--json", { description: message`Emit machine-parseable JSON to stdout` }),
17136
14981
  false
17137
14982
  ),
17138
14983
  debug: withDefault(
17139
- option2("--debug", { description: message`Enable verbose logging to stderr` }),
14984
+ option("--debug", { description: message`Enable verbose logging to stderr` }),
17140
14985
  false
17141
14986
  ),
17142
14987
  nonInteractive: withDefault(
17143
- option2("--non-interactive", {
14988
+ option("--non-interactive", {
17144
14989
  description: message`Auto-confirm dangerous operations; fail when input is missing`
17145
14990
  }),
17146
14991
  false
17147
14992
  ),
17148
14993
  network: optional(
17149
- option2("--network", string({ metavar: "NAME" }), {
14994
+ option("--network", string({ metavar: "NAME" }), {
17150
14995
  description: message`Override the network for this command`
17151
14996
  })
17152
14997
  ),
17153
14998
  account: optional(
17154
- option2("--account", string({ metavar: "NAME" }), {
14999
+ option("--account", string({ metavar: "NAME" }), {
17155
15000
  description: message`Use the named account for signing operations`
17156
15001
  })
17157
15002
  ),
17158
15003
  password: withDefault(
17159
- option2("--password", string({ metavar: "PASSWORD" }), {
15004
+ option("--password", string({ metavar: "PASSWORD" }), {
17160
15005
  description: message`Keystore password for decrypting the account key`
17161
15006
  }),
17162
15007
  () => process.env.FAST_PASSWORD
@@ -17167,7 +15012,7 @@ var accountCreateParser = command(
17167
15012
  object({
17168
15013
  cmd: constant("account-create"),
17169
15014
  name: optional(
17170
- option2("--name", string({ metavar: "NAME" }), {
15015
+ option("--name", string({ metavar: "NAME" }), {
17171
15016
  description: message`Alias for the account`
17172
15017
  })
17173
15018
  )
@@ -17179,17 +15024,17 @@ var accountImportParser = command(
17179
15024
  object({
17180
15025
  cmd: constant("account-import"),
17181
15026
  name: optional(
17182
- option2("--name", string({ metavar: "NAME" }), {
15027
+ option("--name", string({ metavar: "NAME" }), {
17183
15028
  description: message`Alias for the account`
17184
15029
  })
17185
15030
  ),
17186
15031
  privateKey: optional(
17187
- option2("--private-key", string({ metavar: "HEX" }), {
15032
+ option("--private-key", string({ metavar: "HEX" }), {
17188
15033
  description: message`Hex-encoded Ed25519 seed (0x-prefixed or raw)`
17189
15034
  })
17190
15035
  ),
17191
15036
  keyFile: optional(
17192
- option2("--key-file", string({ metavar: "PATH" }), {
15037
+ option("--key-file", string({ metavar: "PATH" }), {
17193
15038
  description: message`Path to a JSON file containing a privateKey field`
17194
15039
  })
17195
15040
  )
@@ -17261,7 +15106,7 @@ var networkAddParser = command(
17261
15106
  name: argument(string({ metavar: "NAME" }), {
17262
15107
  description: message`Name for the custom network`
17263
15108
  }),
17264
- config: option2("--config", string({ metavar: "PATH" }), {
15109
+ config: option("--config", string({ metavar: "PATH" }), {
17265
15110
  description: message`Path to network config JSON file`
17266
15111
  })
17267
15112
  }),
@@ -17309,7 +15154,7 @@ var infoBalanceParser = command(
17309
15154
  object({
17310
15155
  cmd: constant("info-balance"),
17311
15156
  token: optional(
17312
- option2("--token", string({ metavar: "TOKEN" }), {
15157
+ option("--token", string({ metavar: "TOKEN" }), {
17313
15158
  description: message`Filter by token name or token ID`
17314
15159
  })
17315
15160
  )
@@ -17331,28 +15176,28 @@ var infoHistoryParser = command(
17331
15176
  object({
17332
15177
  cmd: constant("info-history"),
17333
15178
  from: optional(
17334
- option2("--from", string({ metavar: "ADDRESS" }), {
15179
+ option("--from", string({ metavar: "ADDRESS" }), {
17335
15180
  description: message`Filter by sender account name or address`
17336
15181
  })
17337
15182
  ),
17338
15183
  to: optional(
17339
- option2("--to", string({ metavar: "ADDRESS" }), {
15184
+ option("--to", string({ metavar: "ADDRESS" }), {
17340
15185
  description: message`Filter by recipient address`
17341
15186
  })
17342
15187
  ),
17343
15188
  token: optional(
17344
- option2("--token", string({ metavar: "TOKEN" }), {
15189
+ option("--token", string({ metavar: "TOKEN" }), {
17345
15190
  description: message`Filter by token`
17346
15191
  })
17347
15192
  ),
17348
15193
  limit: withDefault(
17349
- option2("--limit", integer(), {
15194
+ option("--limit", integer(), {
17350
15195
  description: message`Max number of records to return`
17351
15196
  }),
17352
15197
  20
17353
15198
  ),
17354
15199
  offset: withDefault(
17355
- option2("--offset", integer(), {
15200
+ option("--offset", integer(), {
17356
15201
  description: message`Number of records to skip`
17357
15202
  }),
17358
15203
  0
@@ -17390,22 +15235,22 @@ var sendParser = command(
17390
15235
  description: message`Human-readable amount (e.g., 10.5)`
17391
15236
  }),
17392
15237
  token: optional(
17393
- option2("--token", string({ metavar: "TOKEN" }), {
15238
+ option("--token", string({ metavar: "TOKEN" }), {
17394
15239
  description: message`Token to send (e.g., testUSDC, USDC)`
17395
15240
  })
17396
15241
  ),
17397
15242
  fromChain: optional(
17398
- option2("--from-chain", string({ metavar: "CHAIN" }), {
15243
+ option("--from-chain", string({ metavar: "CHAIN" }), {
17399
15244
  description: message`Source EVM chain for bridge-in (e.g., arbitrum-sepolia)`
17400
15245
  })
17401
15246
  ),
17402
15247
  toChain: optional(
17403
- option2("--to-chain", string({ metavar: "CHAIN" }), {
15248
+ option("--to-chain", string({ metavar: "CHAIN" }), {
17404
15249
  description: message`Destination EVM chain for bridge-out (e.g., arbitrum-sepolia)`
17405
15250
  })
17406
15251
  ),
17407
15252
  eip7702: withDefault(
17408
- option2("--eip-7702", {
15253
+ option("--eip-7702", {
17409
15254
  description: message`Use EIP-7702 smart deposit for EVM → Fast (gas paid in USDC, no ETH required)`
17410
15255
  }),
17411
15256
  false
@@ -17418,7 +15263,7 @@ var fundFiatParser = command(
17418
15263
  object({
17419
15264
  cmd: constant("fund-fiat"),
17420
15265
  address: optional(
17421
- option2("--address", string({ metavar: "ADDRESS" }), {
15266
+ option("--address", string({ metavar: "ADDRESS" }), {
17422
15267
  description: message`Fast address to fund (default: default account)`
17423
15268
  })
17424
15269
  )
@@ -17432,16 +15277,16 @@ var fundCryptoParser = command(
17432
15277
  amount: argument(string({ metavar: "AMOUNT" }), {
17433
15278
  description: message`Human-readable amount to fund (e.g., 100.00)`
17434
15279
  }),
17435
- chain: option2("--chain", string({ metavar: "CHAIN" }), {
15280
+ chain: option("--chain", string({ metavar: "CHAIN" }), {
17436
15281
  description: message`EVM chain to bridge from (see fast info bridge-chains)`
17437
15282
  }),
17438
15283
  token: optional(
17439
- option2("--token", string({ metavar: "TOKEN" }), {
15284
+ option("--token", string({ metavar: "TOKEN" }), {
17440
15285
  description: message`Token to bridge (default: USDC / testUSDC)`
17441
15286
  })
17442
15287
  ),
17443
15288
  eip7702: withDefault(
17444
- option2("--eip-7702", {
15289
+ option("--eip-7702", {
17445
15290
  description: message`Use EIP-7702 smart deposit (gas paid in USDC via paymaster, no ETH required)`
17446
15291
  }),
17447
15292
  false
@@ -17462,27 +15307,27 @@ var payParser = command(
17462
15307
  description: message`URL of the x402-protected resource`
17463
15308
  }),
17464
15309
  dryRun: withDefault(
17465
- option2("--dry-run", {
15310
+ option("--dry-run", {
17466
15311
  description: message`Inspect payment requirements without paying`
17467
15312
  }),
17468
15313
  false
17469
15314
  ),
17470
15315
  method: withDefault(
17471
- option2("--method", string({ metavar: "METHOD" }), {
15316
+ option("--method", string({ metavar: "METHOD" }), {
17472
15317
  description: message`HTTP method (default: GET)`
17473
15318
  }),
17474
15319
  "GET"
17475
15320
  ),
17476
15321
  header: withDefault(
17477
15322
  multiple(
17478
- option2("--header", string({ metavar: "KEY: VALUE" }), {
15323
+ option("--header", string({ metavar: "KEY: VALUE" }), {
17479
15324
  description: message`Custom header (repeatable)`
17480
15325
  })
17481
15326
  ),
17482
15327
  []
17483
15328
  ),
17484
15329
  body: optional(
17485
- option2("--body", string({ metavar: "DATA" }), {
15330
+ option("--body", string({ metavar: "DATA" }), {
17486
15331
  description: message`Request body (prefix with @ to read from file)`
17487
15332
  })
17488
15333
  )
@@ -17614,7 +15459,7 @@ var accountExport = {
17614
15459
  const accountInfo = yield* accounts2.get(accountName);
17615
15460
  const pwd = accountInfo.encrypted ? yield* prompt.password() : null;
17616
15461
  const { seed, entry } = yield* accounts2.export(accountName, pwd);
17617
- const privateKeyHex = toHex3(seed);
15462
+ const privateKeyHex = toHex2(seed);
17618
15463
  yield* output.humanLine(`\u26A0 Private key for "${entry.name}":`);
17619
15464
  yield* output.humanLine(privateKeyHex);
17620
15465
  yield* output.ok({
@@ -17643,7 +15488,7 @@ var accountImport = {
17643
15488
  );
17644
15489
  }
17645
15490
  const parseHexSeed = (hex) => Effect18.try({
17646
- try: () => fromHex3(hex),
15491
+ try: () => fromHex2(hex),
17647
15492
  catch: (e) => new InvalidUsageError({
17648
15493
  message: `Invalid hex in private key: ${e instanceof Error ? e.message : String(e)}`
17649
15494
  })
@@ -17761,13 +15606,13 @@ var accountSetDefault = {
17761
15606
  };
17762
15607
 
17763
15608
  // src/commands/info/balance.ts
17764
- import { bech32m as bech32m3 } from "bech32";
15609
+ import { bech32m as bech32m2 } from "bech32";
17765
15610
  import { Effect as Effect21 } from "effect";
17766
15611
  var fromFastAddress2 = (address) => {
17767
- const { prefix, words } = bech32m3.decode(address);
15612
+ const { prefix, words } = bech32m2.decode(address);
17768
15613
  if (prefix !== "fast")
17769
15614
  throw new Error(`Expected "fast" prefix, got "${prefix}"`);
17770
- return new Uint8Array(bech32m3.fromWords(words));
15615
+ return new Uint8Array(bech32m2.fromWords(words));
17771
15616
  };
17772
15617
  var bytesToHex4 = (bytes) => Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
17773
15618
  var formatAmount = (amount, decimals) => {
@@ -17839,12 +15684,12 @@ var infoBalance = {
17839
15684
  const rows = [
17840
15685
  { network: "Fast", balance: formatAmount(fastRaw, decimals) }
17841
15686
  ];
17842
- for (const chain2 of token.chains) {
15687
+ for (const chain of token.chains) {
17843
15688
  const evmRaw = yield* Effect21.promise(
17844
- () => getEvmErc20Balance(chain2.evmRpcUrl, chain2.evmAddress, evmAddress).catch(() => null)
15689
+ () => getEvmErc20Balance(chain.evmRpcUrl, chain.evmAddress, evmAddress).catch(() => null)
17845
15690
  );
17846
15691
  rows.push({
17847
- network: chain2.chainName,
15692
+ network: chain.chainName,
17848
15693
  balance: evmRaw !== null ? formatAmount(evmRaw, decimals) : "-"
17849
15694
  });
17850
15695
  }
@@ -18206,22 +16051,22 @@ var makeHistoryEntry = (fields) => ({
18206
16051
  });
18207
16052
 
18208
16053
  // src/services/token-resolver.ts
18209
- function resolveToken(tokenName, networkConfig, chain2) {
16054
+ function resolveToken(tokenName, networkConfig, chain) {
18210
16055
  const allset = networkConfig.allSet;
18211
16056
  if (!allset) {
18212
16057
  throw new TokenNotFoundError({ token: tokenName });
18213
16058
  }
18214
- if (chain2) {
18215
- const chainConfig2 = allset.chains[chain2];
16059
+ if (chain) {
16060
+ const chainConfig2 = allset.chains[chain];
18216
16061
  if (!chainConfig2) {
18217
- throw new UnsupportedChainError({ chain: chain2 });
16062
+ throw new UnsupportedChainError({ chain });
18218
16063
  }
18219
16064
  const token = chainConfig2.tokens[tokenName];
18220
16065
  if (!token) {
18221
16066
  throw new TokenNotFoundError({ token: tokenName });
18222
16067
  }
18223
16068
  return {
18224
- fastTokenId: fromHex3(token.fastTokenId),
16069
+ fastTokenId: fromHex2(token.fastTokenId),
18225
16070
  decimals: token.decimals,
18226
16071
  evmAddress: token.evmAddress
18227
16072
  };
@@ -18230,7 +16075,7 @@ function resolveToken(tokenName, networkConfig, chain2) {
18230
16075
  const token = chainConfig2.tokens[tokenName];
18231
16076
  if (token) {
18232
16077
  return {
18233
- fastTokenId: fromHex3(token.fastTokenId),
16078
+ fastTokenId: fromHex2(token.fastTokenId),
18234
16079
  decimals: token.decimals
18235
16080
  };
18236
16081
  }
@@ -18359,7 +16204,7 @@ var fundCrypto = {
18359
16204
  });
18360
16205
  const smartResult = yield* Effect31.tryPromise({
18361
16206
  try: () => smartDeposit({
18362
- privateKey: toHex3(seed),
16207
+ privateKey: toHex2(seed),
18363
16208
  rpcUrl: chainCfg.evmRpcUrl,
18364
16209
  allsetApiUrl: network2.allSet.portalApiUrl,
18365
16210
  tokenAddress: tokenInfo.evmAddress,
@@ -18384,7 +16229,7 @@ var fundCrypto = {
18384
16229
  amount: amountRaw.toString(),
18385
16230
  formatted: args.amount,
18386
16231
  tokenName,
18387
- tokenId: toHex3(tokenInfo.fastTokenId),
16232
+ tokenId: toHex2(tokenInfo.fastTokenId),
18388
16233
  network: config.network,
18389
16234
  status: "pending",
18390
16235
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -18412,7 +16257,7 @@ var fundCrypto = {
18412
16257
  });
18413
16258
  return;
18414
16259
  }
18415
- const evmAccount = bridge.createWallet(toHex3(seed));
16260
+ const evmAccount = bridge.createWallet(toHex2(seed));
18416
16261
  const evmClients = bridge.createExecutor(
18417
16262
  evmAccount,
18418
16263
  chainCfg.evmRpcUrl,
@@ -18438,7 +16283,7 @@ var fundCrypto = {
18438
16283
  amount: amountRaw.toString(),
18439
16284
  formatted: args.amount,
18440
16285
  tokenName,
18441
- tokenId: toHex3(tokenInfo.fastTokenId),
16286
+ tokenId: toHex2(tokenInfo.fastTokenId),
18442
16287
  network: config.network,
18443
16288
  status: "pending",
18444
16289
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -18593,32 +16438,32 @@ var pay2 = {
18593
16438
  try: () => signer.getPublicKey(),
18594
16439
  catch: () => new InvalidPaymentLinkError({ message: "Failed to derive public key" })
18595
16440
  });
18596
- const publicKey = toHex3(publicKeyBytes);
16441
+ const publicKey = toHex2(publicKeyBytes);
18597
16442
  const fastAddress = yield* Effect33.tryPromise({
18598
16443
  try: () => signer.getFastAddress(),
18599
16444
  catch: () => new InvalidPaymentLinkError({ message: "Failed to derive Fast address" })
18600
16445
  });
18601
16446
  const fastWallet = {
18602
16447
  type: "fast",
18603
- privateKey: toHex3(seed),
16448
+ privateKey: toHex2(seed),
18604
16449
  publicKey,
18605
16450
  address: fastAddress,
18606
16451
  rpcUrl: network2.url
18607
16452
  };
18608
16453
  const evmWallet = {
18609
16454
  type: "evm",
18610
- privateKey: toHex3(seed),
16455
+ privateKey: toHex2(seed),
18611
16456
  address: accountInfo.evmAddress
18612
16457
  };
18613
16458
  const evmNetworks = {};
18614
16459
  const allset = network2.allSet;
18615
16460
  if (allset) {
18616
- for (const [name, chain2] of Object.entries(allset.chains)) {
18617
- const usdcToken = chain2.tokens.USDC ?? chain2.tokens.testUSDC;
16461
+ for (const [name, chain] of Object.entries(allset.chains)) {
16462
+ const usdcToken = chain.tokens.USDC ?? chain.tokens.testUSDC;
18618
16463
  if (usdcToken?.evmAddress) {
18619
16464
  evmNetworks[name] = {
18620
- chainId: chain2.chainId,
18621
- rpcUrl: chain2.evmRpcUrl,
16465
+ chainId: chain.chainId,
16466
+ rpcUrl: chain.evmRpcUrl,
18622
16467
  usdcAddress: usdcToken.evmAddress
18623
16468
  };
18624
16469
  }
@@ -18638,31 +16483,31 @@ var pay2 = {
18638
16483
  );
18639
16484
  }
18640
16485
  if (result2.payment) {
18641
- const p4 = result2.payment;
16486
+ const p = result2.payment;
18642
16487
  yield* historyStore.record(
18643
16488
  makeHistoryEntry({
18644
- hash: p4.txHash,
16489
+ hash: p.txHash,
18645
16490
  type: "transfer",
18646
16491
  from: accountInfo.fastAddress,
18647
- to: p4.recipient,
18648
- amount: p4.amount,
18649
- formatted: p4.amount,
16492
+ to: p.recipient,
16493
+ amount: p.amount,
16494
+ formatted: p.amount,
18650
16495
  tokenName: "USDC",
18651
16496
  tokenId: "",
18652
- network: p4.network,
16497
+ network: p.network,
18653
16498
  status: "confirmed",
18654
16499
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
18655
16500
  explorerUrl: "",
18656
- route: p4.network.includes("fast") ? "fast" : "fast-to-evm"
16501
+ route: p.network.includes("fast") ? "fast" : "fast-to-evm"
18657
16502
  })
18658
16503
  );
18659
16504
  }
18660
16505
  if (result2.payment) {
18661
- const p4 = result2.payment;
18662
- yield* output.humanLine(`Payment successful (${p4.network})`);
18663
- yield* output.humanLine(` Amount: ${p4.amount}`);
18664
- yield* output.humanLine(` Recipient: ${p4.recipient}`);
18665
- yield* output.humanLine(` Tx hash: ${p4.txHash}`);
16506
+ const p = result2.payment;
16507
+ yield* output.humanLine(`Payment successful (${p.network})`);
16508
+ yield* output.humanLine(` Amount: ${p.amount}`);
16509
+ yield* output.humanLine(` Recipient: ${p.recipient}`);
16510
+ yield* output.humanLine(` Tx hash: ${p.txHash}`);
18666
16511
  yield* output.humanLine("");
18667
16512
  }
18668
16513
  yield* output.ok({
@@ -18677,8 +16522,8 @@ var pay2 = {
18677
16522
  };
18678
16523
 
18679
16524
  // src/commands/send.ts
18680
- import { bech32m as bech32m4 } from "bech32";
18681
- import { Effect as Effect34, Schema as Schema25 } from "effect";
16525
+ import { bech32m as bech32m3 } from "bech32";
16526
+ import { Effect as Effect34, Schema as Schema7 } from "effect";
18682
16527
  var send = {
18683
16528
  cmd: "send",
18684
16529
  handler: (args) => Effect34.gen(function* () {
@@ -18807,7 +16652,7 @@ var send = {
18807
16652
  });
18808
16653
  const smartResult = yield* Effect34.tryPromise({
18809
16654
  try: () => smartDeposit({
18810
- privateKey: toHex3(seed),
16655
+ privateKey: toHex2(seed),
18811
16656
  rpcUrl: chainCfg.evmRpcUrl,
18812
16657
  allsetApiUrl: allset.portalApiUrl,
18813
16658
  tokenAddress: tokenInfo.evmAddress,
@@ -18828,7 +16673,7 @@ var send = {
18828
16673
  txHash = smartResult.txHash;
18829
16674
  evmExplorerUrl = chainCfg.evmExplorerUrl;
18830
16675
  } else {
18831
- const evmAccount = bridge.createWallet(toHex3(seed));
16676
+ const evmAccount = bridge.createWallet(toHex2(seed));
18832
16677
  const evmClients = bridge.createExecutor(
18833
16678
  evmAccount,
18834
16679
  chainCfg.evmRpcUrl,
@@ -18861,13 +16706,13 @@ var send = {
18861
16706
  );
18862
16707
  }
18863
16708
  const signer = new Signer(seed);
18864
- const provider = new FastProvider({ url: network2.url });
16709
+ const provider = new FastProvider(network2);
18865
16710
  const bridgeResult = yield* bridge.withdraw({
18866
16711
  fastBridgeAddress: chainCfg.fastBridgeAddress,
18867
16712
  relayerUrl: chainCfg.relayerUrl,
18868
16713
  crossSignUrl: allset.crossSignUrl,
18869
16714
  tokenEvmAddress: tokenInfo.evmAddress,
18870
- tokenFastTokenId: toHex3(tokenInfo.fastTokenId).slice(2),
16715
+ tokenFastTokenId: toHex2(tokenInfo.fastTokenId).slice(2),
18871
16716
  amount: amountRaw.toString(),
18872
16717
  receiverEvmAddress: args.address,
18873
16718
  signer,
@@ -18893,7 +16738,7 @@ var send = {
18893
16738
  });
18894
16739
  const nonce = accountInfoRpc?.nextNonce ?? 0n;
18895
16740
  const recipientBytes = new Uint8Array(
18896
- bech32m4.fromWords(bech32m4.decode(args.address).words)
16741
+ bech32m3.fromWords(bech32m3.decode(args.address).words)
18897
16742
  );
18898
16743
  const builder = new TransactionBuilder({
18899
16744
  networkId: network2.networkId,
@@ -18913,7 +16758,7 @@ var send = {
18913
16758
  })
18914
16759
  });
18915
16760
  yield* rpc.submitTransaction(envelope);
18916
- const bcsInput = yield* Schema25.encode(VersionedTransactionFromBcs)(
16761
+ const bcsInput = yield* Schema7.encode(VersionedTransactionFromBcs)(
18917
16762
  envelope.transaction
18918
16763
  ).pipe(
18919
16764
  Effect34.mapError(
@@ -18941,7 +16786,7 @@ var send = {
18941
16786
  amount: amountRaw.toString(),
18942
16787
  formatted: args.amount,
18943
16788
  tokenName: resolvedTokenName,
18944
- tokenId: toHex3(tokenInfo.fastTokenId),
16789
+ tokenId: toHex2(tokenInfo.fastTokenId),
18945
16790
  network: config.network,
18946
16791
  status: route === "fast" ? "confirmed" : "pending",
18947
16792
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -19309,9 +17154,9 @@ var resolveNetwork = async () => {
19309
17154
  if (parsed.network) return parsed.network;
19310
17155
  try {
19311
17156
  const { Effect: Eff, ManagedRuntime, Layer: Layer7 } = await import("effect");
19312
- const { NetworkConfigService: NetworkConfigService2 } = await import("./network-QDRK4P6X.js");
17157
+ const { NetworkConfigService: NetworkConfigService2 } = await import("./network-GHRVPGMD.js");
19313
17158
  const { DatabaseLive: DatabaseLive2 } = await import("./database-NXA7GQKE.js");
19314
- const { AppConfigLive: AppConfigLive2 } = await import("./app-PZWIJK2U.js");
17159
+ const { AppConfigLive: AppConfigLive2 } = await import("./app-ZXKQBKVM.js");
19315
17160
  const layer = Layer7.provide(NetworkConfigService2.Default, Layer7.merge(DatabaseLive2, AppConfigLive2));
19316
17161
  const runtime = ManagedRuntime.make(layer);
19317
17162
  const name = await runtime.runPromise(
@@ -19374,9 +17219,6 @@ dispatch().catch((err2) => {
19374
17219
  @noble/hashes/utils.js:
19375
17220
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
19376
17221
 
19377
- @scure/base/index.js:
19378
- (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
19379
-
19380
17222
  @noble/ed25519/index.js:
19381
17223
  (*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
19382
17224