@solana/web3.js 2.0.0-experimental.527bafd → 2.0.0-experimental.6b66b7d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +7 -0
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +1 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +496 -145
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +1 -0
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +7 -0
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +1 -0
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +16 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/rpc-default-config.d.ts.map +1 -0
- package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -0
- package/dist/types/rpc-request-coalescer.d.ts.map +1 -0
- package/dist/types/rpc-request-deduplication.d.ts.map +1 -0
- package/dist/types/rpc-transport.d.ts.map +1 -0
- package/dist/types/rpc.d.ts.map +1 -0
- package/package.json +17 -16
|
@@ -8,6 +8,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
8
8
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
12
|
var __esm = (fn, res) => function __init() {
|
|
12
13
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
14
|
};
|
|
@@ -30,6 +31,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
30
31
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
32
|
mod
|
|
32
33
|
));
|
|
34
|
+
var __publicField = (obj, key, value) => {
|
|
35
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
36
|
+
return value;
|
|
37
|
+
};
|
|
33
38
|
|
|
34
39
|
// ../build-scripts/env-shim.ts
|
|
35
40
|
var init_env_shim = __esm({
|
|
@@ -37,147 +42,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
37
42
|
}
|
|
38
43
|
});
|
|
39
44
|
|
|
40
|
-
// ../../node_modules/.pnpm/base-x@4.0.0/node_modules/base-x/src/index.js
|
|
41
|
-
var require_src = __commonJS({
|
|
42
|
-
"../../node_modules/.pnpm/base-x@4.0.0/node_modules/base-x/src/index.js"(exports, module) {
|
|
43
|
-
init_env_shim();
|
|
44
|
-
function base(ALPHABET) {
|
|
45
|
-
if (ALPHABET.length >= 255) {
|
|
46
|
-
throw new TypeError("Alphabet too long");
|
|
47
|
-
}
|
|
48
|
-
var BASE_MAP = new Uint8Array(256);
|
|
49
|
-
for (var j = 0; j < BASE_MAP.length; j++) {
|
|
50
|
-
BASE_MAP[j] = 255;
|
|
51
|
-
}
|
|
52
|
-
for (var i = 0; i < ALPHABET.length; i++) {
|
|
53
|
-
var x = ALPHABET.charAt(i);
|
|
54
|
-
var xc = x.charCodeAt(0);
|
|
55
|
-
if (BASE_MAP[xc] !== 255) {
|
|
56
|
-
throw new TypeError(x + " is ambiguous");
|
|
57
|
-
}
|
|
58
|
-
BASE_MAP[xc] = i;
|
|
59
|
-
}
|
|
60
|
-
var BASE = ALPHABET.length;
|
|
61
|
-
var LEADER = ALPHABET.charAt(0);
|
|
62
|
-
var FACTOR = Math.log(BASE) / Math.log(256);
|
|
63
|
-
var iFACTOR = Math.log(256) / Math.log(BASE);
|
|
64
|
-
function encode(source) {
|
|
65
|
-
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
66
|
-
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
67
|
-
} else if (Array.isArray(source)) {
|
|
68
|
-
source = Uint8Array.from(source);
|
|
69
|
-
}
|
|
70
|
-
if (!(source instanceof Uint8Array)) {
|
|
71
|
-
throw new TypeError("Expected Uint8Array");
|
|
72
|
-
}
|
|
73
|
-
if (source.length === 0) {
|
|
74
|
-
return "";
|
|
75
|
-
}
|
|
76
|
-
var zeroes = 0;
|
|
77
|
-
var length = 0;
|
|
78
|
-
var pbegin = 0;
|
|
79
|
-
var pend = source.length;
|
|
80
|
-
while (pbegin !== pend && source[pbegin] === 0) {
|
|
81
|
-
pbegin++;
|
|
82
|
-
zeroes++;
|
|
83
|
-
}
|
|
84
|
-
var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
85
|
-
var b58 = new Uint8Array(size);
|
|
86
|
-
while (pbegin !== pend) {
|
|
87
|
-
var carry = source[pbegin];
|
|
88
|
-
var i2 = 0;
|
|
89
|
-
for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
|
|
90
|
-
carry += 256 * b58[it1] >>> 0;
|
|
91
|
-
b58[it1] = carry % BASE >>> 0;
|
|
92
|
-
carry = carry / BASE >>> 0;
|
|
93
|
-
}
|
|
94
|
-
if (carry !== 0) {
|
|
95
|
-
throw new Error("Non-zero carry");
|
|
96
|
-
}
|
|
97
|
-
length = i2;
|
|
98
|
-
pbegin++;
|
|
99
|
-
}
|
|
100
|
-
var it2 = size - length;
|
|
101
|
-
while (it2 !== size && b58[it2] === 0) {
|
|
102
|
-
it2++;
|
|
103
|
-
}
|
|
104
|
-
var str = LEADER.repeat(zeroes);
|
|
105
|
-
for (; it2 < size; ++it2) {
|
|
106
|
-
str += ALPHABET.charAt(b58[it2]);
|
|
107
|
-
}
|
|
108
|
-
return str;
|
|
109
|
-
}
|
|
110
|
-
function decodeUnsafe(source) {
|
|
111
|
-
if (typeof source !== "string") {
|
|
112
|
-
throw new TypeError("Expected String");
|
|
113
|
-
}
|
|
114
|
-
if (source.length === 0) {
|
|
115
|
-
return new Uint8Array();
|
|
116
|
-
}
|
|
117
|
-
var psz = 0;
|
|
118
|
-
var zeroes = 0;
|
|
119
|
-
var length = 0;
|
|
120
|
-
while (source[psz] === LEADER) {
|
|
121
|
-
zeroes++;
|
|
122
|
-
psz++;
|
|
123
|
-
}
|
|
124
|
-
var size = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
125
|
-
var b256 = new Uint8Array(size);
|
|
126
|
-
while (source[psz]) {
|
|
127
|
-
var carry = BASE_MAP[source.charCodeAt(psz)];
|
|
128
|
-
if (carry === 255) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
var i2 = 0;
|
|
132
|
-
for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
|
|
133
|
-
carry += BASE * b256[it3] >>> 0;
|
|
134
|
-
b256[it3] = carry % 256 >>> 0;
|
|
135
|
-
carry = carry / 256 >>> 0;
|
|
136
|
-
}
|
|
137
|
-
if (carry !== 0) {
|
|
138
|
-
throw new Error("Non-zero carry");
|
|
139
|
-
}
|
|
140
|
-
length = i2;
|
|
141
|
-
psz++;
|
|
142
|
-
}
|
|
143
|
-
var it4 = size - length;
|
|
144
|
-
while (it4 !== size && b256[it4] === 0) {
|
|
145
|
-
it4++;
|
|
146
|
-
}
|
|
147
|
-
var vch = new Uint8Array(zeroes + (size - it4));
|
|
148
|
-
var j2 = zeroes;
|
|
149
|
-
while (it4 !== size) {
|
|
150
|
-
vch[j2++] = b256[it4++];
|
|
151
|
-
}
|
|
152
|
-
return vch;
|
|
153
|
-
}
|
|
154
|
-
function decode(string) {
|
|
155
|
-
var buffer = decodeUnsafe(string);
|
|
156
|
-
if (buffer) {
|
|
157
|
-
return buffer;
|
|
158
|
-
}
|
|
159
|
-
throw new Error("Non-base" + BASE + " character");
|
|
160
|
-
}
|
|
161
|
-
return {
|
|
162
|
-
encode,
|
|
163
|
-
decodeUnsafe,
|
|
164
|
-
decode
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
module.exports = base;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// ../../node_modules/.pnpm/bs58@5.0.0/node_modules/bs58/index.js
|
|
172
|
-
var require_bs58 = __commonJS({
|
|
173
|
-
"../../node_modules/.pnpm/bs58@5.0.0/node_modules/bs58/index.js"(exports, module) {
|
|
174
|
-
init_env_shim();
|
|
175
|
-
var basex = require_src();
|
|
176
|
-
var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
177
|
-
module.exports = basex(ALPHABET);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
45
|
// ../../node_modules/.pnpm/fast-stable-stringify@1.0.0/node_modules/fast-stable-stringify/index.js
|
|
182
46
|
var require_fast_stable_stringify = __commonJS({
|
|
183
47
|
"../../node_modules/.pnpm/fast-stable-stringify@1.0.0/node_modules/fast-stable-stringify/index.js"(exports, module) {
|
|
@@ -258,9 +122,330 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
258
122
|
// src/index.ts
|
|
259
123
|
init_env_shim();
|
|
260
124
|
|
|
125
|
+
// ../instructions/dist/index.browser.js
|
|
126
|
+
init_env_shim();
|
|
127
|
+
var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
|
|
128
|
+
AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
|
|
129
|
+
3] = "WRITABLE_SIGNER";
|
|
130
|
+
AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
|
|
131
|
+
2] = "READONLY_SIGNER";
|
|
132
|
+
AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
|
|
133
|
+
1] = "WRITABLE";
|
|
134
|
+
AccountRole2[AccountRole2["READONLY"] = /* 0 */
|
|
135
|
+
0] = "READONLY";
|
|
136
|
+
return AccountRole2;
|
|
137
|
+
})(AccountRole || {});
|
|
138
|
+
var IS_SIGNER_BITMASK = 2;
|
|
139
|
+
var IS_WRITABLE_BITMASK = 1;
|
|
140
|
+
function downgradeRoleToNonSigner(role) {
|
|
141
|
+
return role & ~IS_SIGNER_BITMASK;
|
|
142
|
+
}
|
|
143
|
+
function downgradeRoleToReadonly(role) {
|
|
144
|
+
return role & ~IS_WRITABLE_BITMASK;
|
|
145
|
+
}
|
|
146
|
+
function isSignerRole(role) {
|
|
147
|
+
return role >= 2;
|
|
148
|
+
}
|
|
149
|
+
function isWritableRole(role) {
|
|
150
|
+
return (role & IS_WRITABLE_BITMASK) !== 0;
|
|
151
|
+
}
|
|
152
|
+
function mergeRoles(roleA, roleB) {
|
|
153
|
+
return roleA | roleB;
|
|
154
|
+
}
|
|
155
|
+
function upgradeRoleToSigner(role) {
|
|
156
|
+
return role | IS_SIGNER_BITMASK;
|
|
157
|
+
}
|
|
158
|
+
function upgradeRoleToWritable(role) {
|
|
159
|
+
return role | IS_WRITABLE_BITMASK;
|
|
160
|
+
}
|
|
161
|
+
|
|
261
162
|
// ../keys/dist/index.browser.js
|
|
262
163
|
init_env_shim();
|
|
263
|
-
|
|
164
|
+
|
|
165
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/index.mjs
|
|
166
|
+
init_env_shim();
|
|
167
|
+
|
|
168
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/index.mjs
|
|
169
|
+
init_env_shim();
|
|
170
|
+
|
|
171
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/bytes.mjs
|
|
172
|
+
init_env_shim();
|
|
173
|
+
var mergeBytes = (bytesArr) => {
|
|
174
|
+
const totalLength = bytesArr.reduce((total, arr) => total + arr.length, 0);
|
|
175
|
+
const result = new Uint8Array(totalLength);
|
|
176
|
+
let offset = 0;
|
|
177
|
+
bytesArr.forEach((arr) => {
|
|
178
|
+
result.set(arr, offset);
|
|
179
|
+
offset += arr.length;
|
|
180
|
+
});
|
|
181
|
+
return result;
|
|
182
|
+
};
|
|
183
|
+
var padBytes = (bytes, length) => {
|
|
184
|
+
if (bytes.length >= length)
|
|
185
|
+
return bytes;
|
|
186
|
+
const paddedBytes = new Uint8Array(length).fill(0);
|
|
187
|
+
paddedBytes.set(bytes);
|
|
188
|
+
return paddedBytes;
|
|
189
|
+
};
|
|
190
|
+
var fixBytes = (bytes, length) => padBytes(bytes.slice(0, length), length);
|
|
191
|
+
|
|
192
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/errors.mjs
|
|
193
|
+
init_env_shim();
|
|
194
|
+
var DeserializingEmptyBufferError = class extends Error {
|
|
195
|
+
constructor(serializer) {
|
|
196
|
+
super(`Serializer [${serializer}] cannot deserialize empty buffers.`);
|
|
197
|
+
__publicField(this, "name", "DeserializingEmptyBufferError");
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
var NotEnoughBytesError = class extends Error {
|
|
201
|
+
constructor(serializer, expected, actual) {
|
|
202
|
+
super(`Serializer [${serializer}] expected ${expected} bytes, got ${actual}.`);
|
|
203
|
+
__publicField(this, "name", "NotEnoughBytesError");
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/fixSerializer.mjs
|
|
208
|
+
init_env_shim();
|
|
209
|
+
function fixSerializer(serializer, fixedBytes, description) {
|
|
210
|
+
return {
|
|
211
|
+
description: description ?? `fixed(${fixedBytes}, ${serializer.description})`,
|
|
212
|
+
fixedSize: fixedBytes,
|
|
213
|
+
maxSize: fixedBytes,
|
|
214
|
+
serialize: (value) => fixBytes(serializer.serialize(value), fixedBytes),
|
|
215
|
+
deserialize: (buffer, offset = 0) => {
|
|
216
|
+
buffer = buffer.slice(offset, offset + fixedBytes);
|
|
217
|
+
if (buffer.length < fixedBytes) {
|
|
218
|
+
throw new NotEnoughBytesError("fixSerializer", fixedBytes, buffer.length);
|
|
219
|
+
}
|
|
220
|
+
if (serializer.fixedSize !== null) {
|
|
221
|
+
buffer = fixBytes(buffer, serializer.fixedSize);
|
|
222
|
+
}
|
|
223
|
+
const [value] = serializer.deserialize(buffer, 0);
|
|
224
|
+
return [value, offset + fixedBytes];
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/index.mjs
|
|
230
|
+
init_env_shim();
|
|
231
|
+
|
|
232
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
|
|
233
|
+
init_env_shim();
|
|
234
|
+
|
|
235
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/errors.mjs
|
|
236
|
+
init_env_shim();
|
|
237
|
+
var InvalidBaseStringError = class extends Error {
|
|
238
|
+
constructor(value, base, cause) {
|
|
239
|
+
const message = `Expected a string of base ${base}, got [${value}].`;
|
|
240
|
+
super(message);
|
|
241
|
+
__publicField(this, "name", "InvalidBaseStringError");
|
|
242
|
+
this.cause = cause;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/baseX.mjs
|
|
247
|
+
var baseX = (alphabet) => {
|
|
248
|
+
const base = alphabet.length;
|
|
249
|
+
const baseBigInt = BigInt(base);
|
|
250
|
+
return {
|
|
251
|
+
description: `base${base}`,
|
|
252
|
+
fixedSize: null,
|
|
253
|
+
maxSize: null,
|
|
254
|
+
serialize(value) {
|
|
255
|
+
if (!value.match(new RegExp(`^[${alphabet}]*$`))) {
|
|
256
|
+
throw new InvalidBaseStringError(value, base);
|
|
257
|
+
}
|
|
258
|
+
if (value === "")
|
|
259
|
+
return new Uint8Array();
|
|
260
|
+
const chars = [...value];
|
|
261
|
+
let trailIndex = chars.findIndex((c) => c !== alphabet[0]);
|
|
262
|
+
trailIndex = trailIndex === -1 ? chars.length : trailIndex;
|
|
263
|
+
const leadingZeroes = Array(trailIndex).fill(0);
|
|
264
|
+
if (trailIndex === chars.length)
|
|
265
|
+
return Uint8Array.from(leadingZeroes);
|
|
266
|
+
const tailChars = chars.slice(trailIndex);
|
|
267
|
+
let base10Number = 0n;
|
|
268
|
+
let baseXPower = 1n;
|
|
269
|
+
for (let i = tailChars.length - 1; i >= 0; i -= 1) {
|
|
270
|
+
base10Number += baseXPower * BigInt(alphabet.indexOf(tailChars[i]));
|
|
271
|
+
baseXPower *= baseBigInt;
|
|
272
|
+
}
|
|
273
|
+
const tailBytes = [];
|
|
274
|
+
while (base10Number > 0n) {
|
|
275
|
+
tailBytes.unshift(Number(base10Number % 256n));
|
|
276
|
+
base10Number /= 256n;
|
|
277
|
+
}
|
|
278
|
+
return Uint8Array.from(leadingZeroes.concat(tailBytes));
|
|
279
|
+
},
|
|
280
|
+
deserialize(buffer, offset = 0) {
|
|
281
|
+
if (buffer.length === 0)
|
|
282
|
+
return ["", 0];
|
|
283
|
+
const bytes = buffer.slice(offset);
|
|
284
|
+
let trailIndex = bytes.findIndex((n) => n !== 0);
|
|
285
|
+
trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
|
|
286
|
+
const leadingZeroes = alphabet[0].repeat(trailIndex);
|
|
287
|
+
if (trailIndex === bytes.length)
|
|
288
|
+
return [leadingZeroes, buffer.length];
|
|
289
|
+
let base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
290
|
+
const tailChars = [];
|
|
291
|
+
while (base10Number > 0n) {
|
|
292
|
+
tailChars.unshift(alphabet[Number(base10Number % baseBigInt)]);
|
|
293
|
+
base10Number /= baseBigInt;
|
|
294
|
+
}
|
|
295
|
+
return [leadingZeroes + tailChars.join(""), buffer.length];
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/base58.mjs
|
|
301
|
+
init_env_shim();
|
|
302
|
+
var base58 = baseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
|
303
|
+
|
|
304
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/nullCharacters.mjs
|
|
305
|
+
init_env_shim();
|
|
306
|
+
var removeNullCharacters = (value) => (
|
|
307
|
+
// eslint-disable-next-line no-control-regex
|
|
308
|
+
value.replace(/\u0000/g, "")
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-encodings@0.8.2/node_modules/@metaplex-foundation/umi-serializers-encodings/dist/esm/utf8.mjs
|
|
312
|
+
init_env_shim();
|
|
313
|
+
var utf8 = {
|
|
314
|
+
description: "utf8",
|
|
315
|
+
fixedSize: null,
|
|
316
|
+
maxSize: null,
|
|
317
|
+
serialize(value) {
|
|
318
|
+
return new TextEncoder().encode(value);
|
|
319
|
+
},
|
|
320
|
+
deserialize(buffer, offset = 0) {
|
|
321
|
+
const value = new TextDecoder().decode(buffer.slice(offset));
|
|
322
|
+
return [removeNullCharacters(value), buffer.length];
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/index.mjs
|
|
327
|
+
init_env_shim();
|
|
328
|
+
|
|
329
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/common.mjs
|
|
330
|
+
init_env_shim();
|
|
331
|
+
var Endian;
|
|
332
|
+
(function(Endian2) {
|
|
333
|
+
Endian2["Little"] = "le";
|
|
334
|
+
Endian2["Big"] = "be";
|
|
335
|
+
})(Endian || (Endian = {}));
|
|
336
|
+
|
|
337
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/errors.mjs
|
|
338
|
+
init_env_shim();
|
|
339
|
+
var NumberOutOfRangeError = class extends RangeError {
|
|
340
|
+
constructor(serializer, min, max, actual) {
|
|
341
|
+
super(`Serializer [${serializer}] expected number to be between ${min} and ${max}, got ${actual}.`);
|
|
342
|
+
__publicField(this, "name", "NumberOutOfRangeError");
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/utils.mjs
|
|
347
|
+
init_env_shim();
|
|
348
|
+
function numberFactory(input) {
|
|
349
|
+
let littleEndian;
|
|
350
|
+
let defaultDescription = input.name;
|
|
351
|
+
if (input.size > 1) {
|
|
352
|
+
littleEndian = !("endian" in input.options) || input.options.endian === Endian.Little;
|
|
353
|
+
defaultDescription += littleEndian ? "(le)" : "(be)";
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
description: input.options.description ?? defaultDescription,
|
|
357
|
+
fixedSize: input.size,
|
|
358
|
+
maxSize: input.size,
|
|
359
|
+
serialize(value) {
|
|
360
|
+
if (input.range) {
|
|
361
|
+
assertRange(input.name, input.range[0], input.range[1], value);
|
|
362
|
+
}
|
|
363
|
+
const buffer = new ArrayBuffer(input.size);
|
|
364
|
+
input.set(new DataView(buffer), value, littleEndian);
|
|
365
|
+
return new Uint8Array(buffer);
|
|
366
|
+
},
|
|
367
|
+
deserialize(bytes, offset = 0) {
|
|
368
|
+
const slice = bytes.slice(offset, offset + input.size);
|
|
369
|
+
assertEnoughBytes("i8", slice, input.size);
|
|
370
|
+
const view = toDataView(slice);
|
|
371
|
+
return [input.get(view, littleEndian), offset + input.size];
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
var toArrayBuffer = (array) => array.buffer.slice(array.byteOffset, array.byteLength + array.byteOffset);
|
|
376
|
+
var toDataView = (array) => new DataView(toArrayBuffer(array));
|
|
377
|
+
var assertRange = (serializer, min, max, value) => {
|
|
378
|
+
if (value < min || value > max) {
|
|
379
|
+
throw new NumberOutOfRangeError(serializer, min, max, value);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
var assertEnoughBytes = (serializer, bytes, expected) => {
|
|
383
|
+
if (bytes.length === 0) {
|
|
384
|
+
throw new DeserializingEmptyBufferError(serializer);
|
|
385
|
+
}
|
|
386
|
+
if (bytes.length < expected) {
|
|
387
|
+
throw new NotEnoughBytesError(serializer, expected, bytes.length);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-numbers@0.8.2/node_modules/@metaplex-foundation/umi-serializers-numbers/dist/esm/u32.mjs
|
|
392
|
+
init_env_shim();
|
|
393
|
+
var u32 = (options = {}) => numberFactory({
|
|
394
|
+
name: "u32",
|
|
395
|
+
size: 4,
|
|
396
|
+
range: [0, Number("0xffffffff")],
|
|
397
|
+
set: (view, value, le) => view.setUint32(0, Number(value), le),
|
|
398
|
+
get: (view, le) => view.getUint32(0, le),
|
|
399
|
+
options
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
|
|
403
|
+
init_env_shim();
|
|
404
|
+
function getSizeDescription(size) {
|
|
405
|
+
return typeof size === "object" ? size.description : `${size}`;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
|
|
409
|
+
init_env_shim();
|
|
410
|
+
function string(options = {}) {
|
|
411
|
+
const size = options.size ?? u32();
|
|
412
|
+
const encoding = options.encoding ?? utf8;
|
|
413
|
+
const description = options.description ?? `string(${encoding.description}; ${getSizeDescription(size)})`;
|
|
414
|
+
if (size === "variable") {
|
|
415
|
+
return {
|
|
416
|
+
...encoding,
|
|
417
|
+
description
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
if (typeof size === "number") {
|
|
421
|
+
return fixSerializer(encoding, size, description);
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
description,
|
|
425
|
+
fixedSize: null,
|
|
426
|
+
maxSize: null,
|
|
427
|
+
serialize: (value) => {
|
|
428
|
+
const contentBytes = encoding.serialize(value);
|
|
429
|
+
const lengthBytes = size.serialize(contentBytes.length);
|
|
430
|
+
return mergeBytes([lengthBytes, contentBytes]);
|
|
431
|
+
},
|
|
432
|
+
deserialize: (buffer, offset = 0) => {
|
|
433
|
+
if (buffer.slice(offset).length === 0) {
|
|
434
|
+
throw new DeserializingEmptyBufferError("string");
|
|
435
|
+
}
|
|
436
|
+
const [lengthBigInt, lengthOffset] = size.deserialize(buffer, offset);
|
|
437
|
+
const length = Number(lengthBigInt);
|
|
438
|
+
offset = lengthOffset;
|
|
439
|
+
const contentBuffer = buffer.slice(offset, offset + length);
|
|
440
|
+
if (contentBuffer.length < length) {
|
|
441
|
+
throw new NotEnoughBytesError("string", length, contentBuffer.length);
|
|
442
|
+
}
|
|
443
|
+
const [value, contentOffset] = encoding.deserialize(contentBuffer);
|
|
444
|
+
offset += contentOffset;
|
|
445
|
+
return [value, offset];
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
}
|
|
264
449
|
function assertIsBase58EncodedAddress(putativeBase58EncodedAddress) {
|
|
265
450
|
try {
|
|
266
451
|
if (
|
|
@@ -270,7 +455,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
270
455
|
) {
|
|
271
456
|
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
272
457
|
}
|
|
273
|
-
const bytes =
|
|
458
|
+
const bytes = base58.serialize(putativeBase58EncodedAddress);
|
|
274
459
|
const numBytes = bytes.byteLength;
|
|
275
460
|
if (numBytes !== 32) {
|
|
276
461
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
@@ -281,13 +466,96 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
281
466
|
});
|
|
282
467
|
}
|
|
283
468
|
}
|
|
469
|
+
function getBase58EncodedAddressCodec(config) {
|
|
470
|
+
return string({
|
|
471
|
+
description: config?.description ?? ("A 32-byte account address" ),
|
|
472
|
+
encoding: base58,
|
|
473
|
+
size: 32
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
function getBase58EncodedAddressComparator() {
|
|
477
|
+
return new Intl.Collator("en", {
|
|
478
|
+
caseFirst: "lower",
|
|
479
|
+
ignorePunctuation: false,
|
|
480
|
+
localeMatcher: "best fit",
|
|
481
|
+
numeric: false,
|
|
482
|
+
sensitivity: "variant",
|
|
483
|
+
usage: "sort"
|
|
484
|
+
}).compare;
|
|
485
|
+
}
|
|
486
|
+
function assertIsSecureContext() {
|
|
487
|
+
if (!globalThis.isSecureContext) {
|
|
488
|
+
throw new Error(
|
|
489
|
+
"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
var cachedEd25519Decision;
|
|
494
|
+
async function isEd25519CurveSupported(subtle) {
|
|
495
|
+
if (cachedEd25519Decision === void 0) {
|
|
496
|
+
cachedEd25519Decision = new Promise((resolve) => {
|
|
497
|
+
subtle.generateKey(
|
|
498
|
+
"Ed25519",
|
|
499
|
+
/* extractable */
|
|
500
|
+
false,
|
|
501
|
+
["sign", "verify"]
|
|
502
|
+
).catch(() => {
|
|
503
|
+
resolve(cachedEd25519Decision = false);
|
|
504
|
+
}).then(() => {
|
|
505
|
+
resolve(cachedEd25519Decision = true);
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
if (typeof cachedEd25519Decision === "boolean") {
|
|
510
|
+
return cachedEd25519Decision;
|
|
511
|
+
} else {
|
|
512
|
+
return await cachedEd25519Decision;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
async function assertKeyGenerationIsAvailable() {
|
|
516
|
+
assertIsSecureContext();
|
|
517
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
|
|
518
|
+
throw new Error("No key generation implementation could be found");
|
|
519
|
+
}
|
|
520
|
+
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
521
|
+
throw new Error("This runtime does not support the generation of Ed25519 keypairs");
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
async function assertKeyExporterIsAvailable() {
|
|
525
|
+
assertIsSecureContext();
|
|
526
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
|
|
527
|
+
throw new Error("No key export implementation could be found");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
async function generateKeyPair() {
|
|
531
|
+
await assertKeyGenerationIsAvailable();
|
|
532
|
+
const keyPair = await crypto.subtle.generateKey(
|
|
533
|
+
/* algorithm */
|
|
534
|
+
"Ed25519",
|
|
535
|
+
// Native implementation status: https://github.com/WICG/webcrypto-secure-curves/issues/20
|
|
536
|
+
/* extractable */
|
|
537
|
+
false,
|
|
538
|
+
// Prevents the bytes of the private key from being visible to JS.
|
|
539
|
+
/* allowed uses */
|
|
540
|
+
["sign", "verify"]
|
|
541
|
+
);
|
|
542
|
+
return keyPair;
|
|
543
|
+
}
|
|
544
|
+
async function getBase58EncodedAddressFromPublicKey(publicKey) {
|
|
545
|
+
await assertKeyExporterIsAvailable();
|
|
546
|
+
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
547
|
+
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
548
|
+
}
|
|
549
|
+
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
550
|
+
const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
|
|
551
|
+
return base58EncodedAddress;
|
|
552
|
+
}
|
|
284
553
|
|
|
285
554
|
// src/rpc.ts
|
|
286
555
|
init_env_shim();
|
|
287
556
|
|
|
288
557
|
// ../rpc-core/dist/index.browser.js
|
|
289
558
|
init_env_shim();
|
|
290
|
-
__toESM(require_bs58(), 1);
|
|
291
559
|
function visitNode(value, keyPath, onIntegerOverflow) {
|
|
292
560
|
if (Array.isArray(value)) {
|
|
293
561
|
return value.map(
|
|
@@ -315,9 +583,79 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
315
583
|
}
|
|
316
584
|
var KEYPATH_WILDCARD = {};
|
|
317
585
|
var ALLOWED_NUMERIC_KEYPATHS = {
|
|
586
|
+
getAccountInfo: [
|
|
587
|
+
// parsed AddressTableLookup account
|
|
588
|
+
["value", "data", "parsed", "info", "lastExtendedSlotStartIndex"],
|
|
589
|
+
// parsed Config account
|
|
590
|
+
["value", "data", "parsed", "info", "slashPenalty"],
|
|
591
|
+
["value", "data", "parsed", "info", "warmupCooldownRate"],
|
|
592
|
+
// parsed Token/Token22 token account
|
|
593
|
+
["value", "data", "parsed", "info", "tokenAmount", "decimals"],
|
|
594
|
+
["value", "data", "parsed", "info", "tokenAmount", "uiAmount"],
|
|
595
|
+
["value", "data", "parsed", "info", "rentExemptReserve", "decimals"],
|
|
596
|
+
["value", "data", "parsed", "info", "delegatedAmount", "decimals"],
|
|
597
|
+
[
|
|
598
|
+
"value",
|
|
599
|
+
"data",
|
|
600
|
+
"parsed",
|
|
601
|
+
"info",
|
|
602
|
+
"extensions",
|
|
603
|
+
KEYPATH_WILDCARD,
|
|
604
|
+
"state",
|
|
605
|
+
"olderTransferFee",
|
|
606
|
+
"transferFeeBasisPoints"
|
|
607
|
+
],
|
|
608
|
+
[
|
|
609
|
+
"value",
|
|
610
|
+
"data",
|
|
611
|
+
"parsed",
|
|
612
|
+
"info",
|
|
613
|
+
"extensions",
|
|
614
|
+
KEYPATH_WILDCARD,
|
|
615
|
+
"state",
|
|
616
|
+
"newerTransferFee",
|
|
617
|
+
"transferFeeBasisPoints"
|
|
618
|
+
],
|
|
619
|
+
["value", "data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "preUpdateAverageRate"],
|
|
620
|
+
["value", "data", "parsed", "info", "extensions", KEYPATH_WILDCARD, "state", "currentRate"],
|
|
621
|
+
// parsed Token/Token22 mint account
|
|
622
|
+
["value", "data", "parsed", "info", "decimals"],
|
|
623
|
+
// parsed Token/Token22 multisig account
|
|
624
|
+
["value", "data", "parsed", "info", "numRequiredSigners"],
|
|
625
|
+
["value", "data", "parsed", "info", "numValidSigners"],
|
|
626
|
+
// parsed Stake account
|
|
627
|
+
["value", "data", "parsed", "info", "stake", "delegation", "warmupCooldownRate"],
|
|
628
|
+
// parsed Sysvar rent account
|
|
629
|
+
["value", "data", "parsed", "info", "exemptionThreshold"],
|
|
630
|
+
["value", "data", "parsed", "info", "burnPercent"],
|
|
631
|
+
// parsed Vote account
|
|
632
|
+
["value", "data", "parsed", "info", "commission"],
|
|
633
|
+
["value", "data", "parsed", "info", "votes", KEYPATH_WILDCARD, "confirmationCount"]
|
|
634
|
+
],
|
|
318
635
|
getBlockTime: [[]],
|
|
319
636
|
getInflationReward: [[KEYPATH_WILDCARD, "commission"]],
|
|
320
637
|
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]],
|
|
638
|
+
getTokenLargestAccounts: [
|
|
639
|
+
["value", KEYPATH_WILDCARD, "decimals"],
|
|
640
|
+
["value", KEYPATH_WILDCARD, "uiAmount"]
|
|
641
|
+
],
|
|
642
|
+
getTransaction: [
|
|
643
|
+
["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
644
|
+
["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
|
|
645
|
+
["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"],
|
|
646
|
+
["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"],
|
|
647
|
+
["meta", "rewards", KEYPATH_WILDCARD, "commission"],
|
|
648
|
+
["meta", "innerInstructions", KEYPATH_WILDCARD, "index"],
|
|
649
|
+
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"],
|
|
650
|
+
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD],
|
|
651
|
+
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "writableIndexes", KEYPATH_WILDCARD],
|
|
652
|
+
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "readonlyIndexes", KEYPATH_WILDCARD],
|
|
653
|
+
["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"],
|
|
654
|
+
["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD],
|
|
655
|
+
["transaction", "message", "header", "numReadonlySignedAccounts"],
|
|
656
|
+
["transaction", "message", "header", "numReadonlyUnsignedAccounts"],
|
|
657
|
+
["transaction", "message", "header", "numRequiredSignatures"]
|
|
658
|
+
],
|
|
321
659
|
getVoteAccounts: [
|
|
322
660
|
["current", KEYPATH_WILDCARD, "commission"],
|
|
323
661
|
["delinquent", KEYPATH_WILDCARD, "commission"]
|
|
@@ -341,7 +679,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
341
679
|
return out;
|
|
342
680
|
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted;
|
|
343
681
|
// Upcast the value to `bigint` unless an allowed keypath is present.
|
|
344
|
-
allowedKeypaths.length === 0
|
|
682
|
+
allowedKeypaths.length === 0 && // Only try to upcast an Integer to `bigint`
|
|
683
|
+
Number.isInteger(value)) {
|
|
345
684
|
return BigInt(value);
|
|
346
685
|
} else {
|
|
347
686
|
return value;
|
|
@@ -682,9 +1021,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
682
1021
|
);
|
|
683
1022
|
}
|
|
684
1023
|
|
|
1024
|
+
exports.AccountRole = AccountRole;
|
|
685
1025
|
exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress;
|
|
686
1026
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
687
1027
|
exports.createSolanaRpc = createSolanaRpc;
|
|
1028
|
+
exports.downgradeRoleToNonSigner = downgradeRoleToNonSigner;
|
|
1029
|
+
exports.downgradeRoleToReadonly = downgradeRoleToReadonly;
|
|
1030
|
+
exports.generateKeyPair = generateKeyPair;
|
|
1031
|
+
exports.getBase58EncodedAddressCodec = getBase58EncodedAddressCodec;
|
|
1032
|
+
exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator;
|
|
1033
|
+
exports.getBase58EncodedAddressFromPublicKey = getBase58EncodedAddressFromPublicKey;
|
|
1034
|
+
exports.isSignerRole = isSignerRole;
|
|
1035
|
+
exports.isWritableRole = isWritableRole;
|
|
1036
|
+
exports.mergeRoles = mergeRoles;
|
|
1037
|
+
exports.upgradeRoleToSigner = upgradeRoleToSigner;
|
|
1038
|
+
exports.upgradeRoleToWritable = upgradeRoleToWritable;
|
|
688
1039
|
|
|
689
1040
|
return exports;
|
|
690
1041
|
|