@debridge-finance/solana-utils 6.2.2 → 6.2.4
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/browser/index.js +252 -109
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/crypto.js +2 -2
- package/dist/cjs/crypto.js.map +1 -1
- package/dist/cjs/helpers.js +22 -0
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/spl.js +2 -2
- package/dist/cjs/spl.js.map +1 -1
- package/dist/esm/crypto.js +3 -3
- package/dist/esm/crypto.js.map +1 -1
- package/dist/esm/helpers.js +20 -0
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/spl.js +2 -2
- package/dist/esm/spl.js.map +1 -1
- package/dist/types/helpers.d.ts +7 -0
- package/dist/types/helpers.d.ts.map +1 -1
- package/dist/types/spl.d.ts +2 -2
- package/dist/types/spl.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -6508,6 +6508,25 @@ var constants$1 = /*#__PURE__*/Object.freeze({
|
|
|
6508
6508
|
dlnDst: dlnDst$1
|
|
6509
6509
|
});
|
|
6510
6510
|
|
|
6511
|
+
/**
|
|
6512
|
+
* Losslessly converts a numeric value (up to uint256) into a BN.
|
|
6513
|
+
* Supports numbers, decimal strings, 0x-prefixed hex strings, byte arrays,
|
|
6514
|
+
* Buffers and BN instances.
|
|
6515
|
+
*/
|
|
6516
|
+
function toBN(value) {
|
|
6517
|
+
if (value === undefined || value === null)
|
|
6518
|
+
return new BN(0);
|
|
6519
|
+
if (BN.isBN(value))
|
|
6520
|
+
return value;
|
|
6521
|
+
if (typeof value === "string") {
|
|
6522
|
+
if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
6523
|
+
const hex = value.slice(2);
|
|
6524
|
+
return hex ? new BN(hex, "hex") : new BN(0);
|
|
6525
|
+
}
|
|
6526
|
+
return new BN(value, 10);
|
|
6527
|
+
}
|
|
6528
|
+
return new BN(value);
|
|
6529
|
+
}
|
|
6511
6530
|
var TimestampCheckKind;
|
|
6512
6531
|
(function (TimestampCheckKind) {
|
|
6513
6532
|
TimestampCheckKind[TimestampCheckKind["Slot"] = 0] = "Slot";
|
|
@@ -6785,6 +6804,7 @@ function sendAll(connection, wallet, transactions, options) {
|
|
|
6785
6804
|
|
|
6786
6805
|
var helpers = /*#__PURE__*/Object.freeze({
|
|
6787
6806
|
__proto__: null,
|
|
6807
|
+
toBN: toBN,
|
|
6788
6808
|
setReplayProtectionIx: setReplayProtectionIx,
|
|
6789
6809
|
setExpirationTimestampIx: setExpirationTimestampIx,
|
|
6790
6810
|
getAccountInfo: getAccountInfo,
|
|
@@ -7042,7 +7062,7 @@ function getShortcutFromAutoParams(params) {
|
|
|
7042
7062
|
return isBuffer(shortcut) ? shortcut : hexToBuffer(shortcut);
|
|
7043
7063
|
}
|
|
7044
7064
|
else {
|
|
7045
|
-
const flags = BigInt(
|
|
7065
|
+
const flags = BigInt(toBN((_b = params.autoParams) === null || _b === void 0 ? void 0 : _b.flags).toString());
|
|
7046
7066
|
const data = (_c = params.autoParams) === null || _c === void 0 ? void 0 : _c.data;
|
|
7047
7067
|
if (!data)
|
|
7048
7068
|
return hashExternalCallBytes(data);
|
|
@@ -7102,7 +7122,7 @@ function hashSubmissionIdRaw(params) {
|
|
|
7102
7122
|
: new PublicKey(params.autoParams.fallbackAddress).toBuffer();
|
|
7103
7123
|
packData = packData.concat([
|
|
7104
7124
|
new BN(((_a = params === null || params === void 0 ? void 0 : params.autoParams) === null || _a === void 0 ? void 0 : _a.executionFee) || 0).toArray("be", 32),
|
|
7105
|
-
|
|
7125
|
+
toBN((_b = params.autoParams) === null || _b === void 0 ? void 0 : _b.flags).toArray("be", 32),
|
|
7106
7126
|
hashExternalCallBytes(fallback),
|
|
7107
7127
|
shortcut,
|
|
7108
7128
|
hashExternalCallBytes(params.autoParams.nativeSender),
|
|
@@ -9955,7 +9975,7 @@ Layout$4.utf8 = ((maxSpan, property) => new UTF8$1(maxSpan, property));
|
|
|
9955
9975
|
/** Factory for {@link Constant} values. */
|
|
9956
9976
|
Layout$4.constant = ((value, property) => new Constant$1(value, property));
|
|
9957
9977
|
|
|
9958
|
-
const encodeDecode$
|
|
9978
|
+
const encodeDecode$2 = (layout) => {
|
|
9959
9979
|
const decode = layout.decode.bind(layout);
|
|
9960
9980
|
const encode = layout.encode.bind(layout);
|
|
9961
9981
|
return { decode, encode };
|
|
@@ -9995,7 +10015,7 @@ function toBigIntBE(buf) {
|
|
|
9995
10015
|
return BigInt(`0x${hex}`);
|
|
9996
10016
|
}
|
|
9997
10017
|
}
|
|
9998
|
-
browser.toBigIntBE = toBigIntBE;
|
|
10018
|
+
var toBigIntBE_1 = browser.toBigIntBE = toBigIntBE;
|
|
9999
10019
|
/**
|
|
10000
10020
|
* Convert a BigInt to a little-endian buffer.
|
|
10001
10021
|
* @param num The BigInt to convert.
|
|
@@ -10023,27 +10043,45 @@ function toBufferBE(num, width) {
|
|
|
10023
10043
|
return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
|
|
10024
10044
|
}
|
|
10025
10045
|
}
|
|
10026
|
-
browser.toBufferBE = toBufferBE;
|
|
10046
|
+
var toBufferBE_1 = browser.toBufferBE = toBufferBE;
|
|
10027
10047
|
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
const
|
|
10038
|
-
|
|
10048
|
+
// https://github.com/no2chem/bigint-buffer/issues/59
|
|
10049
|
+
function assertValidBigInteger(untrustedInput) {
|
|
10050
|
+
if (typeof untrustedInput !== 'bigint') {
|
|
10051
|
+
throw new Error('Expected a `BigInt`');
|
|
10052
|
+
}
|
|
10053
|
+
}
|
|
10054
|
+
function bigInt_IMPL(littleEndian, length) {
|
|
10055
|
+
return (property) => {
|
|
10056
|
+
const layout = blob$1(length, property);
|
|
10057
|
+
const { encode, decode } = encodeDecode$2(layout);
|
|
10058
|
+
const bigIntLayout = layout;
|
|
10059
|
+
bigIntLayout.decode = (buffer$1, offset) => {
|
|
10060
|
+
const src = decode(buffer$1, offset);
|
|
10061
|
+
return littleEndian ? toBigIntLE_1(buffer.Buffer.from(src)) : toBigIntBE_1(buffer.Buffer.from(src));
|
|
10062
|
+
};
|
|
10063
|
+
bigIntLayout.encode = (bigInt, buffer$1, offset) => {
|
|
10064
|
+
assertValidBigInteger(bigInt);
|
|
10065
|
+
let src;
|
|
10066
|
+
if (length === 0) {
|
|
10067
|
+
// https://github.com/no2chem/bigint-buffer/issues/40
|
|
10068
|
+
// `toBuffer{BE|LE}` crashes when passed zero for the `length` argument.
|
|
10069
|
+
src = buffer.Buffer.alloc(0);
|
|
10070
|
+
}
|
|
10071
|
+
else {
|
|
10072
|
+
src = littleEndian ? toBufferLE_1(bigInt, length) : toBufferBE_1(bigInt, length);
|
|
10073
|
+
}
|
|
10074
|
+
return encode(src, buffer$1, offset);
|
|
10075
|
+
};
|
|
10076
|
+
return bigIntLayout;
|
|
10039
10077
|
};
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
const u64$
|
|
10078
|
+
}
|
|
10079
|
+
const bigInt$1 = /* @__PURE__ */ bigInt_IMPL.bind(null, /* littleEndian */ true);
|
|
10080
|
+
const u64$2 = /* @__PURE__ */ bigInt$1(8);
|
|
10043
10081
|
|
|
10044
10082
|
const bool$1 = (property) => {
|
|
10045
10083
|
const layout = u8$1(property);
|
|
10046
|
-
const { encode, decode } = encodeDecode$
|
|
10084
|
+
const { encode, decode } = encodeDecode$2(layout);
|
|
10047
10085
|
const boolLayout = layout;
|
|
10048
10086
|
boolLayout.decode = (buffer, offset) => {
|
|
10049
10087
|
const src = decode(buffer, offset);
|
|
@@ -10056,9 +10094,9 @@ const bool$1 = (property) => {
|
|
|
10056
10094
|
return boolLayout;
|
|
10057
10095
|
};
|
|
10058
10096
|
|
|
10059
|
-
const publicKey$
|
|
10097
|
+
const publicKey$5 = (property) => {
|
|
10060
10098
|
const layout = blob$1(32, property);
|
|
10061
|
-
const { encode, decode } = encodeDecode$
|
|
10099
|
+
const { encode, decode } = encodeDecode$2(layout);
|
|
10062
10100
|
const publicKeyLayout = layout;
|
|
10063
10101
|
publicKeyLayout.decode = (buffer, offset) => {
|
|
10064
10102
|
const src = decode(buffer, offset);
|
|
@@ -10154,12 +10192,14 @@ var TokenInstruction;
|
|
|
10154
10192
|
// ConfidentialMintBurnExtension = 42,
|
|
10155
10193
|
TokenInstruction[TokenInstruction["ScaledUiAmountExtension"] = 43] = "ScaledUiAmountExtension";
|
|
10156
10194
|
TokenInstruction[TokenInstruction["PausableExtension"] = 44] = "PausableExtension";
|
|
10195
|
+
TokenInstruction[TokenInstruction["UnwrapLamports"] = 45] = "UnwrapLamports";
|
|
10196
|
+
TokenInstruction[TokenInstruction["PermissionedBurnExtension"] = 46] = "PermissionedBurnExtension";
|
|
10157
10197
|
})(TokenInstruction || (TokenInstruction = {}));
|
|
10158
10198
|
|
|
10159
10199
|
/** TODO: docs */
|
|
10160
10200
|
struct$1([
|
|
10161
10201
|
u8$1('instruction'),
|
|
10162
|
-
u64$
|
|
10202
|
+
u64$2('amount'),
|
|
10163
10203
|
]);
|
|
10164
10204
|
|
|
10165
10205
|
var AccountType$1;
|
|
@@ -10175,17 +10215,17 @@ const MultisigLayout = struct$1([
|
|
|
10175
10215
|
u8$1('m'),
|
|
10176
10216
|
u8$1('n'),
|
|
10177
10217
|
bool$1('isInitialized'),
|
|
10178
|
-
publicKey$
|
|
10179
|
-
publicKey$
|
|
10180
|
-
publicKey$
|
|
10181
|
-
publicKey$
|
|
10182
|
-
publicKey$
|
|
10183
|
-
publicKey$
|
|
10184
|
-
publicKey$
|
|
10185
|
-
publicKey$
|
|
10186
|
-
publicKey$
|
|
10187
|
-
publicKey$
|
|
10188
|
-
publicKey$
|
|
10218
|
+
publicKey$5('signer1'),
|
|
10219
|
+
publicKey$5('signer2'),
|
|
10220
|
+
publicKey$5('signer3'),
|
|
10221
|
+
publicKey$5('signer4'),
|
|
10222
|
+
publicKey$5('signer5'),
|
|
10223
|
+
publicKey$5('signer6'),
|
|
10224
|
+
publicKey$5('signer7'),
|
|
10225
|
+
publicKey$5('signer8'),
|
|
10226
|
+
publicKey$5('signer9'),
|
|
10227
|
+
publicKey$5('signer10'),
|
|
10228
|
+
publicKey$5('signer11'),
|
|
10189
10229
|
]);
|
|
10190
10230
|
/** Byte length of a multisig */
|
|
10191
10231
|
const MULTISIG_SIZE = MultisigLayout.span;
|
|
@@ -10199,17 +10239,17 @@ var AccountState$1;
|
|
|
10199
10239
|
})(AccountState$1 || (AccountState$1 = {}));
|
|
10200
10240
|
/** Buffer layout for de/serializing a token account */
|
|
10201
10241
|
const AccountLayout$1 = struct$1([
|
|
10202
|
-
publicKey$
|
|
10203
|
-
publicKey$
|
|
10204
|
-
u64$
|
|
10242
|
+
publicKey$5('mint'),
|
|
10243
|
+
publicKey$5('owner'),
|
|
10244
|
+
u64$2('amount'),
|
|
10205
10245
|
u32$1('delegateOption'),
|
|
10206
|
-
publicKey$
|
|
10246
|
+
publicKey$5('delegate'),
|
|
10207
10247
|
u8$1('state'),
|
|
10208
10248
|
u32$1('isNativeOption'),
|
|
10209
|
-
u64$
|
|
10210
|
-
u64$
|
|
10249
|
+
u64$2('isNative'),
|
|
10250
|
+
u64$2('delegatedAmount'),
|
|
10211
10251
|
u32$1('closeAuthorityOption'),
|
|
10212
|
-
publicKey$
|
|
10252
|
+
publicKey$5('closeAuthority'),
|
|
10213
10253
|
]);
|
|
10214
10254
|
/** Byte length of a token account */
|
|
10215
10255
|
const ACCOUNT_SIZE = AccountLayout$1.span;
|
|
@@ -10775,15 +10815,15 @@ tokenGroupMemberCodec.fixedSize;
|
|
|
10775
10815
|
|
|
10776
10816
|
/** Buffer layout for de/serializing a Group Pointer extension */
|
|
10777
10817
|
const GroupMemberPointerLayout = struct$1([
|
|
10778
|
-
publicKey$
|
|
10779
|
-
publicKey$
|
|
10818
|
+
publicKey$5('authority'),
|
|
10819
|
+
publicKey$5('memberAddress'),
|
|
10780
10820
|
]);
|
|
10781
10821
|
GroupMemberPointerLayout.span;
|
|
10782
10822
|
|
|
10783
10823
|
/** Buffer layout for de/serializing a GroupPointer extension */
|
|
10784
10824
|
const GroupPointerLayout = struct$1([
|
|
10785
|
-
publicKey$
|
|
10786
|
-
publicKey$
|
|
10825
|
+
publicKey$5('authority'),
|
|
10826
|
+
publicKey$5('groupAddress'),
|
|
10787
10827
|
]);
|
|
10788
10828
|
GroupPointerLayout.span;
|
|
10789
10829
|
|
|
@@ -10792,7 +10832,7 @@ const ImmutableOwnerLayout = struct$1([]);
|
|
|
10792
10832
|
ImmutableOwnerLayout.span;
|
|
10793
10833
|
|
|
10794
10834
|
const InterestBearingMintConfigStateLayout = struct$1([
|
|
10795
|
-
publicKey$
|
|
10835
|
+
publicKey$5('rateAuthority'),
|
|
10796
10836
|
ns64$1('initializationTimestamp'),
|
|
10797
10837
|
s16('preUpdateAverageRate'),
|
|
10798
10838
|
ns64$1('lastUpdateTimestamp'),
|
|
@@ -10817,8 +10857,8 @@ MemoTransferLayout.span;
|
|
|
10817
10857
|
|
|
10818
10858
|
/** Buffer layout for de/serializing a Metadata Pointer extension */
|
|
10819
10859
|
const MetadataPointerLayout = struct$1([
|
|
10820
|
-
publicKey$
|
|
10821
|
-
publicKey$
|
|
10860
|
+
publicKey$5('authority'),
|
|
10861
|
+
publicKey$5('metadataAddress'),
|
|
10822
10862
|
]);
|
|
10823
10863
|
MetadataPointerLayout.span;
|
|
10824
10864
|
function getMetadataPointerState(mint) {
|
|
@@ -10837,7 +10877,7 @@ function getMetadataPointerState(mint) {
|
|
|
10837
10877
|
}
|
|
10838
10878
|
|
|
10839
10879
|
/** Buffer layout for de/serializing a mint */
|
|
10840
|
-
const MintCloseAuthorityLayout = struct$1([publicKey$
|
|
10880
|
+
const MintCloseAuthorityLayout = struct$1([publicKey$5('closeAuthority')]);
|
|
10841
10881
|
MintCloseAuthorityLayout.span;
|
|
10842
10882
|
|
|
10843
10883
|
/** Buffer layout for de/serializing an account */
|
|
@@ -10854,22 +10894,26 @@ var PausableInstruction;
|
|
|
10854
10894
|
struct$1([
|
|
10855
10895
|
u8$1('instruction'),
|
|
10856
10896
|
u8$1('pausableInstruction'),
|
|
10857
|
-
publicKey$
|
|
10897
|
+
publicKey$5('authority'),
|
|
10858
10898
|
]);
|
|
10859
10899
|
struct$1([u8$1('instruction'), u8$1('pausableInstruction')]);
|
|
10860
10900
|
struct$1([u8$1('instruction'), u8$1('pausableInstruction')]);
|
|
10861
10901
|
|
|
10862
10902
|
/** Buffer layout for de/serializing a pausable config */
|
|
10863
|
-
const PausableConfigLayout = struct$1([publicKey$
|
|
10903
|
+
const PausableConfigLayout = struct$1([publicKey$5('authority'), bool$1('paused')]);
|
|
10864
10904
|
PausableConfigLayout.span;
|
|
10865
10905
|
/** Buffer layout for de/serializing a pausable account */
|
|
10866
10906
|
const PausableAccountLayout = struct$1([]); // esline-disable-line
|
|
10867
10907
|
PausableAccountLayout.span;
|
|
10868
10908
|
|
|
10869
10909
|
/** Buffer layout for de/serializing a mint */
|
|
10870
|
-
const PermanentDelegateLayout = struct$1([publicKey$
|
|
10910
|
+
const PermanentDelegateLayout = struct$1([publicKey$5('delegate')]);
|
|
10871
10911
|
PermanentDelegateLayout.span;
|
|
10872
10912
|
|
|
10913
|
+
/** Buffer layout for de/serializing a permissioned burn config */
|
|
10914
|
+
const PermissionedBurnLayout = struct$1([publicKey$5('authority')]);
|
|
10915
|
+
PermissionedBurnLayout.span;
|
|
10916
|
+
|
|
10873
10917
|
var ScaledUiAmountInstruction;
|
|
10874
10918
|
(function (ScaledUiAmountInstruction) {
|
|
10875
10919
|
ScaledUiAmountInstruction[ScaledUiAmountInstruction["Initialize"] = 0] = "Initialize";
|
|
@@ -10878,20 +10922,20 @@ var ScaledUiAmountInstruction;
|
|
|
10878
10922
|
struct$1([
|
|
10879
10923
|
u8$1('instruction'),
|
|
10880
10924
|
u8$1('scaledUiAmountInstruction'),
|
|
10881
|
-
publicKey$
|
|
10925
|
+
publicKey$5('authority'),
|
|
10882
10926
|
f64('multiplier'),
|
|
10883
10927
|
]);
|
|
10884
10928
|
struct$1([
|
|
10885
10929
|
u8$1('instruction'),
|
|
10886
10930
|
u8$1('scaledUiAmountInstruction'),
|
|
10887
10931
|
f64('multiplier'),
|
|
10888
|
-
u64$
|
|
10932
|
+
u64$2('effectiveTimestamp'),
|
|
10889
10933
|
]);
|
|
10890
10934
|
|
|
10891
10935
|
const ScaledUiAmountConfigLayout = struct$1([
|
|
10892
|
-
publicKey$
|
|
10936
|
+
publicKey$5('authority'),
|
|
10893
10937
|
f64('multiplier'),
|
|
10894
|
-
u64$
|
|
10938
|
+
u64$2('newMultiplierEffectiveTimestamp'),
|
|
10895
10939
|
f64('newMultiplier'),
|
|
10896
10940
|
]);
|
|
10897
10941
|
ScaledUiAmountConfigLayout.span;
|
|
@@ -10899,7 +10943,7 @@ ScaledUiAmountConfigLayout.span;
|
|
|
10899
10943
|
class COptionPublicKeyLayout extends Layout_2$1 {
|
|
10900
10944
|
constructor(property) {
|
|
10901
10945
|
super(-1, property);
|
|
10902
|
-
this.publicKeyLayout = publicKey$
|
|
10946
|
+
this.publicKeyLayout = publicKey$5();
|
|
10903
10947
|
}
|
|
10904
10948
|
decode(buffer, offset = 0) {
|
|
10905
10949
|
const option = buffer[offset];
|
|
@@ -10927,6 +10971,37 @@ class COptionPublicKeyLayout extends Layout_2$1 {
|
|
|
10927
10971
|
throw new RangeError('Buffer must be provided');
|
|
10928
10972
|
}
|
|
10929
10973
|
}
|
|
10974
|
+
class COptionU64Layout extends Layout_2$1 {
|
|
10975
|
+
constructor(property) {
|
|
10976
|
+
super(-1, property);
|
|
10977
|
+
this.u64Layout = u64$2();
|
|
10978
|
+
}
|
|
10979
|
+
decode(buffer, offset = 0) {
|
|
10980
|
+
const option = buffer[offset];
|
|
10981
|
+
if (option === 0) {
|
|
10982
|
+
return null;
|
|
10983
|
+
}
|
|
10984
|
+
return this.u64Layout.decode(buffer, offset + 1);
|
|
10985
|
+
}
|
|
10986
|
+
encode(src, buffer, offset = 0) {
|
|
10987
|
+
if (src === null) {
|
|
10988
|
+
buffer[offset] = 0;
|
|
10989
|
+
return 1;
|
|
10990
|
+
}
|
|
10991
|
+
else {
|
|
10992
|
+
buffer[offset] = 1;
|
|
10993
|
+
this.u64Layout.encode(src, buffer, offset + 1);
|
|
10994
|
+
return 9;
|
|
10995
|
+
}
|
|
10996
|
+
}
|
|
10997
|
+
getSpan(buffer, offset = 0) {
|
|
10998
|
+
if (buffer) {
|
|
10999
|
+
const option = buffer[offset];
|
|
11000
|
+
return option === 0 ? 1 : 1 + this.u64Layout.span;
|
|
11001
|
+
}
|
|
11002
|
+
throw new RangeError('Buffer must be provided');
|
|
11003
|
+
}
|
|
11004
|
+
}
|
|
10930
11005
|
|
|
10931
11006
|
var TransferFeeInstruction;
|
|
10932
11007
|
(function (TransferFeeInstruction) {
|
|
@@ -10944,14 +11019,14 @@ struct$1([
|
|
|
10944
11019
|
new COptionPublicKeyLayout('transferFeeConfigAuthority'),
|
|
10945
11020
|
new COptionPublicKeyLayout('withdrawWithheldAuthority'),
|
|
10946
11021
|
u16('transferFeeBasisPoints'),
|
|
10947
|
-
u64$
|
|
11022
|
+
u64$2('maximumFee'),
|
|
10948
11023
|
]);
|
|
10949
11024
|
struct$1([
|
|
10950
11025
|
u8$1('instruction'),
|
|
10951
11026
|
u8$1('transferFeeInstruction'),
|
|
10952
|
-
u64$
|
|
11027
|
+
u64$2('amount'),
|
|
10953
11028
|
u8$1('decimals'),
|
|
10954
|
-
u64$
|
|
11029
|
+
u64$2('fee'),
|
|
10955
11030
|
]);
|
|
10956
11031
|
struct$1([
|
|
10957
11032
|
u8$1('instruction'),
|
|
@@ -10970,37 +11045,37 @@ struct$1([
|
|
|
10970
11045
|
u8$1('instruction'),
|
|
10971
11046
|
u8$1('transferFeeInstruction'),
|
|
10972
11047
|
u16('transferFeeBasisPoints'),
|
|
10973
|
-
u64$
|
|
11048
|
+
u64$2('maximumFee'),
|
|
10974
11049
|
]);
|
|
10975
11050
|
|
|
10976
11051
|
const MAX_FEE_BASIS_POINTS = 10000;
|
|
10977
11052
|
BigInt(MAX_FEE_BASIS_POINTS);
|
|
10978
11053
|
/** Buffer layout for de/serializing a transfer fee */
|
|
10979
11054
|
function transferFeeLayout(property) {
|
|
10980
|
-
return struct$1([u64$
|
|
11055
|
+
return struct$1([u64$2('epoch'), u64$2('maximumFee'), u16('transferFeeBasisPoints')], property);
|
|
10981
11056
|
}
|
|
10982
11057
|
/** Buffer layout for de/serializing a transfer fee config extension */
|
|
10983
11058
|
const TransferFeeConfigLayout = struct$1([
|
|
10984
|
-
publicKey$
|
|
10985
|
-
publicKey$
|
|
10986
|
-
u64$
|
|
11059
|
+
publicKey$5('transferFeeConfigAuthority'),
|
|
11060
|
+
publicKey$5('withdrawWithheldAuthority'),
|
|
11061
|
+
u64$2('withheldAmount'),
|
|
10987
11062
|
transferFeeLayout('olderTransferFee'),
|
|
10988
11063
|
transferFeeLayout('newerTransferFee'),
|
|
10989
11064
|
]);
|
|
10990
11065
|
TransferFeeConfigLayout.span;
|
|
10991
11066
|
/** Buffer layout for de/serializing */
|
|
10992
|
-
const TransferFeeAmountLayout = struct$1([u64$
|
|
11067
|
+
const TransferFeeAmountLayout = struct$1([u64$2('withheldAmount')]);
|
|
10993
11068
|
TransferFeeAmountLayout.span;
|
|
10994
11069
|
|
|
10995
11070
|
/** TODO: docs */
|
|
10996
11071
|
struct$1([
|
|
10997
11072
|
u8$1('instruction'),
|
|
10998
|
-
u64$
|
|
11073
|
+
u64$2('amount'),
|
|
10999
11074
|
u8$1('decimals'),
|
|
11000
11075
|
]);
|
|
11001
11076
|
|
|
11002
11077
|
/** Buffer layout for de/serializing a transfer hook extension */
|
|
11003
|
-
const TransferHookLayout = struct$1([publicKey$
|
|
11078
|
+
const TransferHookLayout = struct$1([publicKey$5('authority'), publicKey$5('programId')]);
|
|
11004
11079
|
TransferHookLayout.span;
|
|
11005
11080
|
/** Buffer layout for de/serializing a transfer hook account extension */
|
|
11006
11081
|
const TransferHookAccountLayout = struct$1([bool$1('transferring')]);
|
|
@@ -11019,7 +11094,7 @@ const ExtraAccountMetaListLayout = struct$1([
|
|
|
11019
11094
|
]);
|
|
11020
11095
|
/** Buffer layout for de/serializing an ExtraAccountMetaAccountData */
|
|
11021
11096
|
struct$1([
|
|
11022
|
-
u64$
|
|
11097
|
+
u64$2('instructionDiscriminator'),
|
|
11023
11098
|
u32$1('length'),
|
|
11024
11099
|
ExtraAccountMetaListLayout.replicate('extraAccountsList'),
|
|
11025
11100
|
]);
|
|
@@ -11033,14 +11108,14 @@ var TransferHookInstruction;
|
|
|
11033
11108
|
struct$1([
|
|
11034
11109
|
u8$1('instruction'),
|
|
11035
11110
|
u8$1('transferHookInstruction'),
|
|
11036
|
-
publicKey$
|
|
11037
|
-
publicKey$
|
|
11111
|
+
publicKey$5('authority'),
|
|
11112
|
+
publicKey$5('transferHookProgramId'),
|
|
11038
11113
|
]);
|
|
11039
11114
|
/** The struct that represents the instruction data as it is read by the program */
|
|
11040
11115
|
struct$1([
|
|
11041
11116
|
u8$1('instruction'),
|
|
11042
11117
|
u8$1('transferHookInstruction'),
|
|
11043
|
-
publicKey$
|
|
11118
|
+
publicKey$5('transferHookProgramId'),
|
|
11044
11119
|
]);
|
|
11045
11120
|
|
|
11046
11121
|
// Sequence from https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L903
|
|
@@ -11074,6 +11149,7 @@ var ExtensionType;
|
|
|
11074
11149
|
ExtensionType[ExtensionType["ScaledUiAmountConfig"] = 25] = "ScaledUiAmountConfig";
|
|
11075
11150
|
ExtensionType[ExtensionType["PausableConfig"] = 26] = "PausableConfig";
|
|
11076
11151
|
ExtensionType[ExtensionType["PausableAccount"] = 27] = "PausableAccount";
|
|
11152
|
+
ExtensionType[ExtensionType["PermissionedBurn"] = 28] = "PermissionedBurn";
|
|
11077
11153
|
})(ExtensionType || (ExtensionType = {}));
|
|
11078
11154
|
const TYPE_SIZE = 2;
|
|
11079
11155
|
const LENGTH_SIZE = 2;
|
|
@@ -11108,12 +11184,12 @@ function getExtensionTypes(tlvData) {
|
|
|
11108
11184
|
/** Buffer layout for de/serializing a mint */
|
|
11109
11185
|
const MintLayout = struct$1([
|
|
11110
11186
|
u32$1('mintAuthorityOption'),
|
|
11111
|
-
publicKey$
|
|
11112
|
-
u64$
|
|
11187
|
+
publicKey$5('mintAuthority'),
|
|
11188
|
+
u64$2('supply'),
|
|
11113
11189
|
u8$1('decimals'),
|
|
11114
11190
|
bool$1('isInitialized'),
|
|
11115
11191
|
u32$1('freezeAuthorityOption'),
|
|
11116
|
-
publicKey$
|
|
11192
|
+
publicKey$5('freezeAuthority'),
|
|
11117
11193
|
]);
|
|
11118
11194
|
/** Byte length of a mint */
|
|
11119
11195
|
const MINT_SIZE = MintLayout.span;
|
|
@@ -11158,22 +11234,22 @@ function unpackMint(address, info, programId = TOKEN_PROGRAM_ID) {
|
|
|
11158
11234
|
new PublicKey('SysvarC1ock11111111111111111111111111111111');
|
|
11159
11235
|
|
|
11160
11236
|
/** TODO: docs */
|
|
11161
|
-
struct$1([u8$1('instruction'), u64$
|
|
11237
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11162
11238
|
|
|
11163
11239
|
/** TODO: docs */
|
|
11164
11240
|
struct$1([
|
|
11165
11241
|
u8$1('instruction'),
|
|
11166
|
-
u64$
|
|
11242
|
+
u64$2('amount'),
|
|
11167
11243
|
u8$1('decimals'),
|
|
11168
11244
|
]);
|
|
11169
11245
|
|
|
11170
11246
|
/** TODO: docs */
|
|
11171
|
-
struct$1([u8$1('instruction'), u64$
|
|
11247
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11172
11248
|
|
|
11173
11249
|
/** TODO: docs */
|
|
11174
11250
|
struct$1([
|
|
11175
11251
|
u8$1('instruction'),
|
|
11176
|
-
u64$
|
|
11252
|
+
u64$2('amount'),
|
|
11177
11253
|
u8$1('decimals'),
|
|
11178
11254
|
]);
|
|
11179
11255
|
|
|
@@ -11187,7 +11263,7 @@ struct$1([u8$1('instruction')]);
|
|
|
11187
11263
|
struct$1([
|
|
11188
11264
|
u8$1('instruction'),
|
|
11189
11265
|
u8$1('decimals'),
|
|
11190
|
-
publicKey$
|
|
11266
|
+
publicKey$5('mintAuthority'),
|
|
11191
11267
|
new COptionPublicKeyLayout('freezeAuthority'),
|
|
11192
11268
|
]);
|
|
11193
11269
|
|
|
@@ -11207,12 +11283,12 @@ struct$1([u8$1('instruction')]);
|
|
|
11207
11283
|
struct$1([u8$1('instruction')]);
|
|
11208
11284
|
|
|
11209
11285
|
/** TODO: docs */
|
|
11210
|
-
struct$1([u8$1('instruction'), u64$
|
|
11286
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11211
11287
|
|
|
11212
11288
|
/** TODO: docs */
|
|
11213
11289
|
struct$1([
|
|
11214
11290
|
u8$1('instruction'),
|
|
11215
|
-
u64$
|
|
11291
|
+
u64$2('amount'),
|
|
11216
11292
|
u8$1('decimals'),
|
|
11217
11293
|
]);
|
|
11218
11294
|
|
|
@@ -11239,6 +11315,7 @@ var AuthorityType;
|
|
|
11239
11315
|
AuthorityType[AuthorityType["GroupMemberPointer"] = 14] = "GroupMemberPointer";
|
|
11240
11316
|
AuthorityType[AuthorityType["ScaledUiAmountConfig"] = 15] = "ScaledUiAmountConfig";
|
|
11241
11317
|
AuthorityType[AuthorityType["PausableConfig"] = 16] = "PausableConfig";
|
|
11318
|
+
AuthorityType[AuthorityType["PermissionedBurn"] = 17] = "PermissionedBurn";
|
|
11242
11319
|
})(AuthorityType || (AuthorityType = {}));
|
|
11243
11320
|
/** TODO: docs */
|
|
11244
11321
|
struct$1([
|
|
@@ -11251,7 +11328,13 @@ struct$1([
|
|
|
11251
11328
|
struct$1([u8$1('instruction')]);
|
|
11252
11329
|
|
|
11253
11330
|
/** TODO: docs */
|
|
11254
|
-
struct$1([u8$1('instruction'), u64$
|
|
11331
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11332
|
+
|
|
11333
|
+
/** TODO: docs */
|
|
11334
|
+
struct$1([
|
|
11335
|
+
u8$1('instruction'),
|
|
11336
|
+
new COptionU64Layout('amount'),
|
|
11337
|
+
]);
|
|
11255
11338
|
|
|
11256
11339
|
var GroupMemberPointerInstruction;
|
|
11257
11340
|
(function (GroupMemberPointerInstruction) {
|
|
@@ -11262,14 +11345,14 @@ struct$1([
|
|
|
11262
11345
|
// prettier-ignore
|
|
11263
11346
|
u8$1('instruction'),
|
|
11264
11347
|
u8$1('groupMemberPointerInstruction'),
|
|
11265
|
-
publicKey$
|
|
11266
|
-
publicKey$
|
|
11348
|
+
publicKey$5('authority'),
|
|
11349
|
+
publicKey$5('memberAddress'),
|
|
11267
11350
|
]);
|
|
11268
11351
|
struct$1([
|
|
11269
11352
|
// prettier-ignore
|
|
11270
11353
|
u8$1('instruction'),
|
|
11271
11354
|
u8$1('groupMemberPointerInstruction'),
|
|
11272
|
-
publicKey$
|
|
11355
|
+
publicKey$5('memberAddress'),
|
|
11273
11356
|
]);
|
|
11274
11357
|
|
|
11275
11358
|
var GroupPointerInstruction;
|
|
@@ -11281,21 +11364,21 @@ struct$1([
|
|
|
11281
11364
|
// prettier-ignore
|
|
11282
11365
|
u8$1('instruction'),
|
|
11283
11366
|
u8$1('groupPointerInstruction'),
|
|
11284
|
-
publicKey$
|
|
11285
|
-
publicKey$
|
|
11367
|
+
publicKey$5('authority'),
|
|
11368
|
+
publicKey$5('groupAddress'),
|
|
11286
11369
|
]);
|
|
11287
11370
|
struct$1([
|
|
11288
11371
|
// prettier-ignore
|
|
11289
11372
|
u8$1('instruction'),
|
|
11290
11373
|
u8$1('groupPointerInstruction'),
|
|
11291
|
-
publicKey$
|
|
11374
|
+
publicKey$5('groupAddress'),
|
|
11292
11375
|
]);
|
|
11293
11376
|
|
|
11294
11377
|
/** TODO: docs */
|
|
11295
11378
|
struct$1([
|
|
11296
11379
|
u8$1('instruction'),
|
|
11297
11380
|
u8$1('decimals'),
|
|
11298
|
-
publicKey$
|
|
11381
|
+
publicKey$5('mintAuthority'),
|
|
11299
11382
|
new COptionPublicKeyLayout('freezeAuthority'),
|
|
11300
11383
|
]);
|
|
11301
11384
|
|
|
@@ -11308,7 +11391,7 @@ struct$1([
|
|
|
11308
11391
|
u8$1('instruction'),
|
|
11309
11392
|
u8$1('interestBearingMintInstruction'),
|
|
11310
11393
|
// TODO: Make this an optional public key
|
|
11311
|
-
publicKey$
|
|
11394
|
+
publicKey$5('rateAuthority'),
|
|
11312
11395
|
s16('rate'),
|
|
11313
11396
|
]);
|
|
11314
11397
|
struct$1([
|
|
@@ -11326,14 +11409,14 @@ struct$1([
|
|
|
11326
11409
|
// prettier-ignore
|
|
11327
11410
|
u8$1('instruction'),
|
|
11328
11411
|
u8$1('metadataPointerInstruction'),
|
|
11329
|
-
publicKey$
|
|
11330
|
-
publicKey$
|
|
11412
|
+
publicKey$5('authority'),
|
|
11413
|
+
publicKey$5('metadataAddress'),
|
|
11331
11414
|
]);
|
|
11332
11415
|
struct$1([
|
|
11333
11416
|
// prettier-ignore
|
|
11334
11417
|
u8$1('instruction'),
|
|
11335
11418
|
u8$1('metadataPointerInstruction'),
|
|
11336
|
-
publicKey$
|
|
11419
|
+
publicKey$5('metadataAddress'),
|
|
11337
11420
|
]);
|
|
11338
11421
|
|
|
11339
11422
|
var Field;
|
|
@@ -11385,14 +11468,37 @@ function unpack(buffer) {
|
|
|
11385
11468
|
};
|
|
11386
11469
|
}
|
|
11387
11470
|
|
|
11471
|
+
var PermissionedBurnInstruction;
|
|
11472
|
+
(function (PermissionedBurnInstruction) {
|
|
11473
|
+
PermissionedBurnInstruction[PermissionedBurnInstruction["Initialize"] = 0] = "Initialize";
|
|
11474
|
+
PermissionedBurnInstruction[PermissionedBurnInstruction["Burn"] = 1] = "Burn";
|
|
11475
|
+
PermissionedBurnInstruction[PermissionedBurnInstruction["BurnChecked"] = 2] = "BurnChecked";
|
|
11476
|
+
})(PermissionedBurnInstruction || (PermissionedBurnInstruction = {}));
|
|
11477
|
+
struct$1([
|
|
11478
|
+
u8$1('instruction'),
|
|
11479
|
+
u8$1('permissionedBurnInstruction'),
|
|
11480
|
+
publicKey$5('authority'),
|
|
11481
|
+
]);
|
|
11482
|
+
struct$1([
|
|
11483
|
+
u8$1('instruction'),
|
|
11484
|
+
u8$1('permissionedBurnInstruction'),
|
|
11485
|
+
u64$2('amount'),
|
|
11486
|
+
]);
|
|
11487
|
+
struct$1([
|
|
11488
|
+
u8$1('instruction'),
|
|
11489
|
+
u8$1('permissionedBurnInstruction'),
|
|
11490
|
+
u64$2('amount'),
|
|
11491
|
+
u8$1('decimals'),
|
|
11492
|
+
]);
|
|
11493
|
+
|
|
11388
11494
|
struct$1([
|
|
11389
11495
|
u8$1('instruction'),
|
|
11390
|
-
publicKey$
|
|
11496
|
+
publicKey$5('owner'),
|
|
11391
11497
|
]);
|
|
11392
11498
|
|
|
11393
11499
|
struct$1([
|
|
11394
11500
|
u8$1('instruction'),
|
|
11395
|
-
publicKey$
|
|
11501
|
+
publicKey$5('owner'),
|
|
11396
11502
|
]);
|
|
11397
11503
|
|
|
11398
11504
|
/** The struct that represents the instruction data as it is read by the program */
|
|
@@ -11414,9 +11520,46 @@ struct$1([
|
|
|
11414
11520
|
/** TODO: docs */
|
|
11415
11521
|
struct$1([
|
|
11416
11522
|
u8$1('instruction'),
|
|
11417
|
-
publicKey$
|
|
11523
|
+
publicKey$5('delegate'),
|
|
11418
11524
|
]);
|
|
11419
11525
|
|
|
11526
|
+
const encodeDecode$1 = (layout) => {
|
|
11527
|
+
const decode = layout.decode.bind(layout);
|
|
11528
|
+
const encode = layout.encode.bind(layout);
|
|
11529
|
+
return { decode, encode };
|
|
11530
|
+
};
|
|
11531
|
+
|
|
11532
|
+
const bigInt = (length) => (property) => {
|
|
11533
|
+
const layout = blob$1(length, property);
|
|
11534
|
+
const { encode, decode } = encodeDecode$1(layout);
|
|
11535
|
+
const bigIntLayout = layout;
|
|
11536
|
+
bigIntLayout.decode = (buffer, offset) => {
|
|
11537
|
+
const src = decode(buffer, offset);
|
|
11538
|
+
return toBigIntLE_1(Buffer.from(src));
|
|
11539
|
+
};
|
|
11540
|
+
bigIntLayout.encode = (bigInt, buffer, offset) => {
|
|
11541
|
+
const src = toBufferLE_1(bigInt, length);
|
|
11542
|
+
return encode(src, buffer, offset);
|
|
11543
|
+
};
|
|
11544
|
+
return bigIntLayout;
|
|
11545
|
+
};
|
|
11546
|
+
const u64$1 = bigInt(8);
|
|
11547
|
+
|
|
11548
|
+
const publicKey$4 = (property) => {
|
|
11549
|
+
const layout = blob$1(32, property);
|
|
11550
|
+
const { encode, decode } = encodeDecode$1(layout);
|
|
11551
|
+
const publicKeyLayout = layout;
|
|
11552
|
+
publicKeyLayout.decode = (buffer, offset) => {
|
|
11553
|
+
const src = decode(buffer, offset);
|
|
11554
|
+
return new PublicKey(src);
|
|
11555
|
+
};
|
|
11556
|
+
publicKeyLayout.encode = (publicKey, buffer, offset) => {
|
|
11557
|
+
const src = publicKey.toBuffer();
|
|
11558
|
+
return encode(src, buffer, offset);
|
|
11559
|
+
};
|
|
11560
|
+
return publicKeyLayout;
|
|
11561
|
+
};
|
|
11562
|
+
|
|
11420
11563
|
var nodeCache = {exports: {}};
|
|
11421
11564
|
|
|
11422
11565
|
var node_cache = {exports: {}};
|
|
@@ -13313,9 +13456,9 @@ function getAssocSPLWalletBalance(connection, originalWallet, tokenMint) {
|
|
|
13313
13456
|
* Returns balance of specified wallets. null if account doesn't exist
|
|
13314
13457
|
* @param wallet spl-tokens wallet address
|
|
13315
13458
|
*/
|
|
13316
|
-
function getWalletsBalances(connection, wallets) {
|
|
13459
|
+
function getWalletsBalances(connection, wallets, commitment) {
|
|
13317
13460
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13318
|
-
const infos = yield connection.getMultipleAccountsInfo(wallets.map((w) => new PublicKey(w)),
|
|
13461
|
+
const infos = yield connection.getMultipleAccountsInfo(wallets.map((w) => new PublicKey(w)), commitment);
|
|
13319
13462
|
const results = [];
|
|
13320
13463
|
for (const info of infos) {
|
|
13321
13464
|
if (!info || info.lamports === 0) {
|
|
@@ -30730,16 +30873,16 @@ function generateLogsParsingRegex() {
|
|
|
30730
30873
|
"Program consumption: {} units remaining"
|
|
30731
30874
|
];
|
|
30732
30875
|
const prepareLineForRegex = (l) => l.replaceAll("{}", ".*").replaceAll("(", "\\(").replaceAll(")", "\\)").replaceAll("]", "\\]").replaceAll("[", "\\[");
|
|
30733
|
-
const regexTemplate = `\
|
|
30734
|
-
(?<logTruncated>^Log truncated$)|\
|
|
30735
|
-
(?<programInvoke>^Program (?<invokeProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) invoke \\[(?<level>\\d+)\\]$)|\
|
|
30736
|
-
(?<programSuccessResult>^Program (?<successResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) success$)|\
|
|
30737
|
-
(?<programFailedResult>^Program (?<failedResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) failed: (?<failedResultErr>.*)$)|\
|
|
30738
|
-
(?<programCompleteFailedResult>^Program failed to complete: (?<failedCompleteError>.*)$)|\
|
|
30739
|
-
(?<programLog>^Program log: (?<logMessage>.*)$)|\
|
|
30740
|
-
(?<programData>^Program data: (?<data>.*)$)|\
|
|
30741
|
-
(?<programConsumed>^Program (?<consumedProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) consumed (?<consumedComputeUnits>\\d*) of (?<allComputedUnits>\\d*) compute units$)|\
|
|
30742
|
-
(?<programReturn>^Program return: (?<returnProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) (?<returnMessage>.*)$)|\
|
|
30876
|
+
const regexTemplate = `\
|
|
30877
|
+
(?<logTruncated>^Log truncated$)|\
|
|
30878
|
+
(?<programInvoke>^Program (?<invokeProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) invoke \\[(?<level>\\d+)\\]$)|\
|
|
30879
|
+
(?<programSuccessResult>^Program (?<successResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) success$)|\
|
|
30880
|
+
(?<programFailedResult>^Program (?<failedResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) failed: (?<failedResultErr>.*)$)|\
|
|
30881
|
+
(?<programCompleteFailedResult>^Program failed to complete: (?<failedCompleteError>.*)$)|\
|
|
30882
|
+
(?<programLog>^Program log: (?<logMessage>.*)$)|\
|
|
30883
|
+
(?<programData>^Program data: (?<data>.*)$)|\
|
|
30884
|
+
(?<programConsumed>^Program (?<consumedProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) consumed (?<consumedComputeUnits>\\d*) of (?<allComputedUnits>\\d*) compute units$)|\
|
|
30885
|
+
(?<programReturn>^Program return: (?<returnProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) (?<returnMessage>.*)$)|\
|
|
30743
30886
|
(?<errorMessage>^(${knownMsgs.map(prepareLineForRegex).join("|")})$)`;
|
|
30744
30887
|
return new RegExp(regexTemplate, "s");
|
|
30745
30888
|
}
|