@debridge-finance/solana-utils 6.2.3 → 6.2.5
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 +231 -153
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/spl.js +3 -22
- package/dist/cjs/spl.js.map +1 -1
- package/dist/esm/spl.js +4 -24
- package/dist/esm/spl.js.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
|
@@ -9975,7 +9975,7 @@ Layout$4.utf8 = ((maxSpan, property) => new UTF8$1(maxSpan, property));
|
|
|
9975
9975
|
/** Factory for {@link Constant} values. */
|
|
9976
9976
|
Layout$4.constant = ((value, property) => new Constant$1(value, property));
|
|
9977
9977
|
|
|
9978
|
-
const encodeDecode$
|
|
9978
|
+
const encodeDecode$2 = (layout) => {
|
|
9979
9979
|
const decode = layout.decode.bind(layout);
|
|
9980
9980
|
const encode = layout.encode.bind(layout);
|
|
9981
9981
|
return { decode, encode };
|
|
@@ -10015,7 +10015,7 @@ function toBigIntBE(buf) {
|
|
|
10015
10015
|
return BigInt(`0x${hex}`);
|
|
10016
10016
|
}
|
|
10017
10017
|
}
|
|
10018
|
-
browser.toBigIntBE = toBigIntBE;
|
|
10018
|
+
var toBigIntBE_1 = browser.toBigIntBE = toBigIntBE;
|
|
10019
10019
|
/**
|
|
10020
10020
|
* Convert a BigInt to a little-endian buffer.
|
|
10021
10021
|
* @param num The BigInt to convert.
|
|
@@ -10043,27 +10043,45 @@ function toBufferBE(num, width) {
|
|
|
10043
10043
|
return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
|
|
10044
10044
|
}
|
|
10045
10045
|
}
|
|
10046
|
-
browser.toBufferBE = toBufferBE;
|
|
10046
|
+
var toBufferBE_1 = browser.toBufferBE = toBufferBE;
|
|
10047
10047
|
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
const
|
|
10058
|
-
|
|
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;
|
|
10059
10077
|
};
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
const u64$
|
|
10078
|
+
}
|
|
10079
|
+
const bigInt$1 = /* @__PURE__ */ bigInt_IMPL.bind(null, /* littleEndian */ true);
|
|
10080
|
+
const u64$2 = /* @__PURE__ */ bigInt$1(8);
|
|
10063
10081
|
|
|
10064
10082
|
const bool$1 = (property) => {
|
|
10065
10083
|
const layout = u8$1(property);
|
|
10066
|
-
const { encode, decode } = encodeDecode$
|
|
10084
|
+
const { encode, decode } = encodeDecode$2(layout);
|
|
10067
10085
|
const boolLayout = layout;
|
|
10068
10086
|
boolLayout.decode = (buffer, offset) => {
|
|
10069
10087
|
const src = decode(buffer, offset);
|
|
@@ -10076,9 +10094,9 @@ const bool$1 = (property) => {
|
|
|
10076
10094
|
return boolLayout;
|
|
10077
10095
|
};
|
|
10078
10096
|
|
|
10079
|
-
const publicKey$
|
|
10097
|
+
const publicKey$5 = (property) => {
|
|
10080
10098
|
const layout = blob$1(32, property);
|
|
10081
|
-
const { encode, decode } = encodeDecode$
|
|
10099
|
+
const { encode, decode } = encodeDecode$2(layout);
|
|
10082
10100
|
const publicKeyLayout = layout;
|
|
10083
10101
|
publicKeyLayout.decode = (buffer, offset) => {
|
|
10084
10102
|
const src = decode(buffer, offset);
|
|
@@ -10174,12 +10192,14 @@ var TokenInstruction;
|
|
|
10174
10192
|
// ConfidentialMintBurnExtension = 42,
|
|
10175
10193
|
TokenInstruction[TokenInstruction["ScaledUiAmountExtension"] = 43] = "ScaledUiAmountExtension";
|
|
10176
10194
|
TokenInstruction[TokenInstruction["PausableExtension"] = 44] = "PausableExtension";
|
|
10195
|
+
TokenInstruction[TokenInstruction["UnwrapLamports"] = 45] = "UnwrapLamports";
|
|
10196
|
+
TokenInstruction[TokenInstruction["PermissionedBurnExtension"] = 46] = "PermissionedBurnExtension";
|
|
10177
10197
|
})(TokenInstruction || (TokenInstruction = {}));
|
|
10178
10198
|
|
|
10179
10199
|
/** TODO: docs */
|
|
10180
10200
|
struct$1([
|
|
10181
10201
|
u8$1('instruction'),
|
|
10182
|
-
u64$
|
|
10202
|
+
u64$2('amount'),
|
|
10183
10203
|
]);
|
|
10184
10204
|
|
|
10185
10205
|
var AccountType$1;
|
|
@@ -10195,17 +10215,17 @@ const MultisigLayout = struct$1([
|
|
|
10195
10215
|
u8$1('m'),
|
|
10196
10216
|
u8$1('n'),
|
|
10197
10217
|
bool$1('isInitialized'),
|
|
10198
|
-
publicKey$
|
|
10199
|
-
publicKey$
|
|
10200
|
-
publicKey$
|
|
10201
|
-
publicKey$
|
|
10202
|
-
publicKey$
|
|
10203
|
-
publicKey$
|
|
10204
|
-
publicKey$
|
|
10205
|
-
publicKey$
|
|
10206
|
-
publicKey$
|
|
10207
|
-
publicKey$
|
|
10208
|
-
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'),
|
|
10209
10229
|
]);
|
|
10210
10230
|
/** Byte length of a multisig */
|
|
10211
10231
|
const MULTISIG_SIZE = MultisigLayout.span;
|
|
@@ -10219,17 +10239,17 @@ var AccountState$1;
|
|
|
10219
10239
|
})(AccountState$1 || (AccountState$1 = {}));
|
|
10220
10240
|
/** Buffer layout for de/serializing a token account */
|
|
10221
10241
|
const AccountLayout$1 = struct$1([
|
|
10222
|
-
publicKey$
|
|
10223
|
-
publicKey$
|
|
10224
|
-
u64$
|
|
10242
|
+
publicKey$5('mint'),
|
|
10243
|
+
publicKey$5('owner'),
|
|
10244
|
+
u64$2('amount'),
|
|
10225
10245
|
u32$1('delegateOption'),
|
|
10226
|
-
publicKey$
|
|
10246
|
+
publicKey$5('delegate'),
|
|
10227
10247
|
u8$1('state'),
|
|
10228
10248
|
u32$1('isNativeOption'),
|
|
10229
|
-
u64$
|
|
10230
|
-
u64$
|
|
10249
|
+
u64$2('isNative'),
|
|
10250
|
+
u64$2('delegatedAmount'),
|
|
10231
10251
|
u32$1('closeAuthorityOption'),
|
|
10232
|
-
publicKey$
|
|
10252
|
+
publicKey$5('closeAuthority'),
|
|
10233
10253
|
]);
|
|
10234
10254
|
/** Byte length of a token account */
|
|
10235
10255
|
const ACCOUNT_SIZE = AccountLayout$1.span;
|
|
@@ -10795,15 +10815,15 @@ tokenGroupMemberCodec.fixedSize;
|
|
|
10795
10815
|
|
|
10796
10816
|
/** Buffer layout for de/serializing a Group Pointer extension */
|
|
10797
10817
|
const GroupMemberPointerLayout = struct$1([
|
|
10798
|
-
publicKey$
|
|
10799
|
-
publicKey$
|
|
10818
|
+
publicKey$5('authority'),
|
|
10819
|
+
publicKey$5('memberAddress'),
|
|
10800
10820
|
]);
|
|
10801
10821
|
GroupMemberPointerLayout.span;
|
|
10802
10822
|
|
|
10803
10823
|
/** Buffer layout for de/serializing a GroupPointer extension */
|
|
10804
10824
|
const GroupPointerLayout = struct$1([
|
|
10805
|
-
publicKey$
|
|
10806
|
-
publicKey$
|
|
10825
|
+
publicKey$5('authority'),
|
|
10826
|
+
publicKey$5('groupAddress'),
|
|
10807
10827
|
]);
|
|
10808
10828
|
GroupPointerLayout.span;
|
|
10809
10829
|
|
|
@@ -10812,7 +10832,7 @@ const ImmutableOwnerLayout = struct$1([]);
|
|
|
10812
10832
|
ImmutableOwnerLayout.span;
|
|
10813
10833
|
|
|
10814
10834
|
const InterestBearingMintConfigStateLayout = struct$1([
|
|
10815
|
-
publicKey$
|
|
10835
|
+
publicKey$5('rateAuthority'),
|
|
10816
10836
|
ns64$1('initializationTimestamp'),
|
|
10817
10837
|
s16('preUpdateAverageRate'),
|
|
10818
10838
|
ns64$1('lastUpdateTimestamp'),
|
|
@@ -10837,27 +10857,13 @@ MemoTransferLayout.span;
|
|
|
10837
10857
|
|
|
10838
10858
|
/** Buffer layout for de/serializing a Metadata Pointer extension */
|
|
10839
10859
|
const MetadataPointerLayout = struct$1([
|
|
10840
|
-
publicKey$
|
|
10841
|
-
publicKey$
|
|
10860
|
+
publicKey$5('authority'),
|
|
10861
|
+
publicKey$5('metadataAddress'),
|
|
10842
10862
|
]);
|
|
10843
10863
|
MetadataPointerLayout.span;
|
|
10844
|
-
function getMetadataPointerState(mint) {
|
|
10845
|
-
const extensionData = getExtensionData(ExtensionType.MetadataPointer, mint.tlvData);
|
|
10846
|
-
if (extensionData !== null) {
|
|
10847
|
-
const { authority, metadataAddress } = MetadataPointerLayout.decode(extensionData);
|
|
10848
|
-
// Explicitly set None/Zero keys to null
|
|
10849
|
-
return {
|
|
10850
|
-
authority: authority.equals(PublicKey.default) ? null : authority,
|
|
10851
|
-
metadataAddress: metadataAddress.equals(PublicKey.default) ? null : metadataAddress,
|
|
10852
|
-
};
|
|
10853
|
-
}
|
|
10854
|
-
else {
|
|
10855
|
-
return null;
|
|
10856
|
-
}
|
|
10857
|
-
}
|
|
10858
10864
|
|
|
10859
10865
|
/** Buffer layout for de/serializing a mint */
|
|
10860
|
-
const MintCloseAuthorityLayout = struct$1([publicKey$
|
|
10866
|
+
const MintCloseAuthorityLayout = struct$1([publicKey$5('closeAuthority')]);
|
|
10861
10867
|
MintCloseAuthorityLayout.span;
|
|
10862
10868
|
|
|
10863
10869
|
/** Buffer layout for de/serializing an account */
|
|
@@ -10874,22 +10880,26 @@ var PausableInstruction;
|
|
|
10874
10880
|
struct$1([
|
|
10875
10881
|
u8$1('instruction'),
|
|
10876
10882
|
u8$1('pausableInstruction'),
|
|
10877
|
-
publicKey$
|
|
10883
|
+
publicKey$5('authority'),
|
|
10878
10884
|
]);
|
|
10879
10885
|
struct$1([u8$1('instruction'), u8$1('pausableInstruction')]);
|
|
10880
10886
|
struct$1([u8$1('instruction'), u8$1('pausableInstruction')]);
|
|
10881
10887
|
|
|
10882
10888
|
/** Buffer layout for de/serializing a pausable config */
|
|
10883
|
-
const PausableConfigLayout = struct$1([publicKey$
|
|
10889
|
+
const PausableConfigLayout = struct$1([publicKey$5('authority'), bool$1('paused')]);
|
|
10884
10890
|
PausableConfigLayout.span;
|
|
10885
10891
|
/** Buffer layout for de/serializing a pausable account */
|
|
10886
10892
|
const PausableAccountLayout = struct$1([]); // esline-disable-line
|
|
10887
10893
|
PausableAccountLayout.span;
|
|
10888
10894
|
|
|
10889
10895
|
/** Buffer layout for de/serializing a mint */
|
|
10890
|
-
const PermanentDelegateLayout = struct$1([publicKey$
|
|
10896
|
+
const PermanentDelegateLayout = struct$1([publicKey$5('delegate')]);
|
|
10891
10897
|
PermanentDelegateLayout.span;
|
|
10892
10898
|
|
|
10899
|
+
/** Buffer layout for de/serializing a permissioned burn config */
|
|
10900
|
+
const PermissionedBurnLayout = struct$1([publicKey$5('authority')]);
|
|
10901
|
+
PermissionedBurnLayout.span;
|
|
10902
|
+
|
|
10893
10903
|
var ScaledUiAmountInstruction;
|
|
10894
10904
|
(function (ScaledUiAmountInstruction) {
|
|
10895
10905
|
ScaledUiAmountInstruction[ScaledUiAmountInstruction["Initialize"] = 0] = "Initialize";
|
|
@@ -10898,20 +10908,20 @@ var ScaledUiAmountInstruction;
|
|
|
10898
10908
|
struct$1([
|
|
10899
10909
|
u8$1('instruction'),
|
|
10900
10910
|
u8$1('scaledUiAmountInstruction'),
|
|
10901
|
-
publicKey$
|
|
10911
|
+
publicKey$5('authority'),
|
|
10902
10912
|
f64('multiplier'),
|
|
10903
10913
|
]);
|
|
10904
10914
|
struct$1([
|
|
10905
10915
|
u8$1('instruction'),
|
|
10906
10916
|
u8$1('scaledUiAmountInstruction'),
|
|
10907
10917
|
f64('multiplier'),
|
|
10908
|
-
u64$
|
|
10918
|
+
u64$2('effectiveTimestamp'),
|
|
10909
10919
|
]);
|
|
10910
10920
|
|
|
10911
10921
|
const ScaledUiAmountConfigLayout = struct$1([
|
|
10912
|
-
publicKey$
|
|
10922
|
+
publicKey$5('authority'),
|
|
10913
10923
|
f64('multiplier'),
|
|
10914
|
-
u64$
|
|
10924
|
+
u64$2('newMultiplierEffectiveTimestamp'),
|
|
10915
10925
|
f64('newMultiplier'),
|
|
10916
10926
|
]);
|
|
10917
10927
|
ScaledUiAmountConfigLayout.span;
|
|
@@ -10919,7 +10929,7 @@ ScaledUiAmountConfigLayout.span;
|
|
|
10919
10929
|
class COptionPublicKeyLayout extends Layout_2$1 {
|
|
10920
10930
|
constructor(property) {
|
|
10921
10931
|
super(-1, property);
|
|
10922
|
-
this.publicKeyLayout = publicKey$
|
|
10932
|
+
this.publicKeyLayout = publicKey$5();
|
|
10923
10933
|
}
|
|
10924
10934
|
decode(buffer, offset = 0) {
|
|
10925
10935
|
const option = buffer[offset];
|
|
@@ -10947,6 +10957,37 @@ class COptionPublicKeyLayout extends Layout_2$1 {
|
|
|
10947
10957
|
throw new RangeError('Buffer must be provided');
|
|
10948
10958
|
}
|
|
10949
10959
|
}
|
|
10960
|
+
class COptionU64Layout extends Layout_2$1 {
|
|
10961
|
+
constructor(property) {
|
|
10962
|
+
super(-1, property);
|
|
10963
|
+
this.u64Layout = u64$2();
|
|
10964
|
+
}
|
|
10965
|
+
decode(buffer, offset = 0) {
|
|
10966
|
+
const option = buffer[offset];
|
|
10967
|
+
if (option === 0) {
|
|
10968
|
+
return null;
|
|
10969
|
+
}
|
|
10970
|
+
return this.u64Layout.decode(buffer, offset + 1);
|
|
10971
|
+
}
|
|
10972
|
+
encode(src, buffer, offset = 0) {
|
|
10973
|
+
if (src === null) {
|
|
10974
|
+
buffer[offset] = 0;
|
|
10975
|
+
return 1;
|
|
10976
|
+
}
|
|
10977
|
+
else {
|
|
10978
|
+
buffer[offset] = 1;
|
|
10979
|
+
this.u64Layout.encode(src, buffer, offset + 1);
|
|
10980
|
+
return 9;
|
|
10981
|
+
}
|
|
10982
|
+
}
|
|
10983
|
+
getSpan(buffer, offset = 0) {
|
|
10984
|
+
if (buffer) {
|
|
10985
|
+
const option = buffer[offset];
|
|
10986
|
+
return option === 0 ? 1 : 1 + this.u64Layout.span;
|
|
10987
|
+
}
|
|
10988
|
+
throw new RangeError('Buffer must be provided');
|
|
10989
|
+
}
|
|
10990
|
+
}
|
|
10950
10991
|
|
|
10951
10992
|
var TransferFeeInstruction;
|
|
10952
10993
|
(function (TransferFeeInstruction) {
|
|
@@ -10964,14 +11005,14 @@ struct$1([
|
|
|
10964
11005
|
new COptionPublicKeyLayout('transferFeeConfigAuthority'),
|
|
10965
11006
|
new COptionPublicKeyLayout('withdrawWithheldAuthority'),
|
|
10966
11007
|
u16('transferFeeBasisPoints'),
|
|
10967
|
-
u64$
|
|
11008
|
+
u64$2('maximumFee'),
|
|
10968
11009
|
]);
|
|
10969
11010
|
struct$1([
|
|
10970
11011
|
u8$1('instruction'),
|
|
10971
11012
|
u8$1('transferFeeInstruction'),
|
|
10972
|
-
u64$
|
|
11013
|
+
u64$2('amount'),
|
|
10973
11014
|
u8$1('decimals'),
|
|
10974
|
-
u64$
|
|
11015
|
+
u64$2('fee'),
|
|
10975
11016
|
]);
|
|
10976
11017
|
struct$1([
|
|
10977
11018
|
u8$1('instruction'),
|
|
@@ -10990,37 +11031,37 @@ struct$1([
|
|
|
10990
11031
|
u8$1('instruction'),
|
|
10991
11032
|
u8$1('transferFeeInstruction'),
|
|
10992
11033
|
u16('transferFeeBasisPoints'),
|
|
10993
|
-
u64$
|
|
11034
|
+
u64$2('maximumFee'),
|
|
10994
11035
|
]);
|
|
10995
11036
|
|
|
10996
11037
|
const MAX_FEE_BASIS_POINTS = 10000;
|
|
10997
11038
|
BigInt(MAX_FEE_BASIS_POINTS);
|
|
10998
11039
|
/** Buffer layout for de/serializing a transfer fee */
|
|
10999
11040
|
function transferFeeLayout(property) {
|
|
11000
|
-
return struct$1([u64$
|
|
11041
|
+
return struct$1([u64$2('epoch'), u64$2('maximumFee'), u16('transferFeeBasisPoints')], property);
|
|
11001
11042
|
}
|
|
11002
11043
|
/** Buffer layout for de/serializing a transfer fee config extension */
|
|
11003
11044
|
const TransferFeeConfigLayout = struct$1([
|
|
11004
|
-
publicKey$
|
|
11005
|
-
publicKey$
|
|
11006
|
-
u64$
|
|
11045
|
+
publicKey$5('transferFeeConfigAuthority'),
|
|
11046
|
+
publicKey$5('withdrawWithheldAuthority'),
|
|
11047
|
+
u64$2('withheldAmount'),
|
|
11007
11048
|
transferFeeLayout('olderTransferFee'),
|
|
11008
11049
|
transferFeeLayout('newerTransferFee'),
|
|
11009
11050
|
]);
|
|
11010
11051
|
TransferFeeConfigLayout.span;
|
|
11011
11052
|
/** Buffer layout for de/serializing */
|
|
11012
|
-
const TransferFeeAmountLayout = struct$1([u64$
|
|
11053
|
+
const TransferFeeAmountLayout = struct$1([u64$2('withheldAmount')]);
|
|
11013
11054
|
TransferFeeAmountLayout.span;
|
|
11014
11055
|
|
|
11015
11056
|
/** TODO: docs */
|
|
11016
11057
|
struct$1([
|
|
11017
11058
|
u8$1('instruction'),
|
|
11018
|
-
u64$
|
|
11059
|
+
u64$2('amount'),
|
|
11019
11060
|
u8$1('decimals'),
|
|
11020
11061
|
]);
|
|
11021
11062
|
|
|
11022
11063
|
/** Buffer layout for de/serializing a transfer hook extension */
|
|
11023
|
-
const TransferHookLayout = struct$1([publicKey$
|
|
11064
|
+
const TransferHookLayout = struct$1([publicKey$5('authority'), publicKey$5('programId')]);
|
|
11024
11065
|
TransferHookLayout.span;
|
|
11025
11066
|
/** Buffer layout for de/serializing a transfer hook account extension */
|
|
11026
11067
|
const TransferHookAccountLayout = struct$1([bool$1('transferring')]);
|
|
@@ -11039,7 +11080,7 @@ const ExtraAccountMetaListLayout = struct$1([
|
|
|
11039
11080
|
]);
|
|
11040
11081
|
/** Buffer layout for de/serializing an ExtraAccountMetaAccountData */
|
|
11041
11082
|
struct$1([
|
|
11042
|
-
u64$
|
|
11083
|
+
u64$2('instructionDiscriminator'),
|
|
11043
11084
|
u32$1('length'),
|
|
11044
11085
|
ExtraAccountMetaListLayout.replicate('extraAccountsList'),
|
|
11045
11086
|
]);
|
|
@@ -11053,14 +11094,14 @@ var TransferHookInstruction;
|
|
|
11053
11094
|
struct$1([
|
|
11054
11095
|
u8$1('instruction'),
|
|
11055
11096
|
u8$1('transferHookInstruction'),
|
|
11056
|
-
publicKey$
|
|
11057
|
-
publicKey$
|
|
11097
|
+
publicKey$5('authority'),
|
|
11098
|
+
publicKey$5('transferHookProgramId'),
|
|
11058
11099
|
]);
|
|
11059
11100
|
/** The struct that represents the instruction data as it is read by the program */
|
|
11060
11101
|
struct$1([
|
|
11061
11102
|
u8$1('instruction'),
|
|
11062
11103
|
u8$1('transferHookInstruction'),
|
|
11063
|
-
publicKey$
|
|
11104
|
+
publicKey$5('transferHookProgramId'),
|
|
11064
11105
|
]);
|
|
11065
11106
|
|
|
11066
11107
|
// Sequence from https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L903
|
|
@@ -11094,6 +11135,7 @@ var ExtensionType;
|
|
|
11094
11135
|
ExtensionType[ExtensionType["ScaledUiAmountConfig"] = 25] = "ScaledUiAmountConfig";
|
|
11095
11136
|
ExtensionType[ExtensionType["PausableConfig"] = 26] = "PausableConfig";
|
|
11096
11137
|
ExtensionType[ExtensionType["PausableAccount"] = 27] = "PausableAccount";
|
|
11138
|
+
ExtensionType[ExtensionType["PermissionedBurn"] = 28] = "PermissionedBurn";
|
|
11097
11139
|
})(ExtensionType || (ExtensionType = {}));
|
|
11098
11140
|
const TYPE_SIZE = 2;
|
|
11099
11141
|
const LENGTH_SIZE = 2;
|
|
@@ -11113,27 +11155,16 @@ function getExtensionData(extension, tlvData) {
|
|
|
11113
11155
|
}
|
|
11114
11156
|
return null;
|
|
11115
11157
|
}
|
|
11116
|
-
function getExtensionTypes(tlvData) {
|
|
11117
|
-
const extensionTypes = [];
|
|
11118
|
-
let extensionTypeIndex = 0;
|
|
11119
|
-
while (extensionTypeIndex < tlvData.length) {
|
|
11120
|
-
const entryType = tlvData.readUInt16LE(extensionTypeIndex);
|
|
11121
|
-
extensionTypes.push(entryType);
|
|
11122
|
-
const entryLength = tlvData.readUInt16LE(extensionTypeIndex + TYPE_SIZE);
|
|
11123
|
-
extensionTypeIndex += addTypeAndLengthToLen(entryLength);
|
|
11124
|
-
}
|
|
11125
|
-
return extensionTypes;
|
|
11126
|
-
}
|
|
11127
11158
|
|
|
11128
11159
|
/** Buffer layout for de/serializing a mint */
|
|
11129
11160
|
const MintLayout = struct$1([
|
|
11130
11161
|
u32$1('mintAuthorityOption'),
|
|
11131
|
-
publicKey$
|
|
11132
|
-
u64$
|
|
11162
|
+
publicKey$5('mintAuthority'),
|
|
11163
|
+
u64$2('supply'),
|
|
11133
11164
|
u8$1('decimals'),
|
|
11134
11165
|
bool$1('isInitialized'),
|
|
11135
11166
|
u32$1('freezeAuthorityOption'),
|
|
11136
|
-
publicKey$
|
|
11167
|
+
publicKey$5('freezeAuthority'),
|
|
11137
11168
|
]);
|
|
11138
11169
|
/** Byte length of a mint */
|
|
11139
11170
|
const MINT_SIZE = MintLayout.span;
|
|
@@ -11178,22 +11209,22 @@ function unpackMint(address, info, programId = TOKEN_PROGRAM_ID) {
|
|
|
11178
11209
|
new PublicKey('SysvarC1ock11111111111111111111111111111111');
|
|
11179
11210
|
|
|
11180
11211
|
/** TODO: docs */
|
|
11181
|
-
struct$1([u8$1('instruction'), u64$
|
|
11212
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11182
11213
|
|
|
11183
11214
|
/** TODO: docs */
|
|
11184
11215
|
struct$1([
|
|
11185
11216
|
u8$1('instruction'),
|
|
11186
|
-
u64$
|
|
11217
|
+
u64$2('amount'),
|
|
11187
11218
|
u8$1('decimals'),
|
|
11188
11219
|
]);
|
|
11189
11220
|
|
|
11190
11221
|
/** TODO: docs */
|
|
11191
|
-
struct$1([u8$1('instruction'), u64$
|
|
11222
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11192
11223
|
|
|
11193
11224
|
/** TODO: docs */
|
|
11194
11225
|
struct$1([
|
|
11195
11226
|
u8$1('instruction'),
|
|
11196
|
-
u64$
|
|
11227
|
+
u64$2('amount'),
|
|
11197
11228
|
u8$1('decimals'),
|
|
11198
11229
|
]);
|
|
11199
11230
|
|
|
@@ -11207,7 +11238,7 @@ struct$1([u8$1('instruction')]);
|
|
|
11207
11238
|
struct$1([
|
|
11208
11239
|
u8$1('instruction'),
|
|
11209
11240
|
u8$1('decimals'),
|
|
11210
|
-
publicKey$
|
|
11241
|
+
publicKey$5('mintAuthority'),
|
|
11211
11242
|
new COptionPublicKeyLayout('freezeAuthority'),
|
|
11212
11243
|
]);
|
|
11213
11244
|
|
|
@@ -11227,12 +11258,12 @@ struct$1([u8$1('instruction')]);
|
|
|
11227
11258
|
struct$1([u8$1('instruction')]);
|
|
11228
11259
|
|
|
11229
11260
|
/** TODO: docs */
|
|
11230
|
-
struct$1([u8$1('instruction'), u64$
|
|
11261
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11231
11262
|
|
|
11232
11263
|
/** TODO: docs */
|
|
11233
11264
|
struct$1([
|
|
11234
11265
|
u8$1('instruction'),
|
|
11235
|
-
u64$
|
|
11266
|
+
u64$2('amount'),
|
|
11236
11267
|
u8$1('decimals'),
|
|
11237
11268
|
]);
|
|
11238
11269
|
|
|
@@ -11259,6 +11290,7 @@ var AuthorityType;
|
|
|
11259
11290
|
AuthorityType[AuthorityType["GroupMemberPointer"] = 14] = "GroupMemberPointer";
|
|
11260
11291
|
AuthorityType[AuthorityType["ScaledUiAmountConfig"] = 15] = "ScaledUiAmountConfig";
|
|
11261
11292
|
AuthorityType[AuthorityType["PausableConfig"] = 16] = "PausableConfig";
|
|
11293
|
+
AuthorityType[AuthorityType["PermissionedBurn"] = 17] = "PermissionedBurn";
|
|
11262
11294
|
})(AuthorityType || (AuthorityType = {}));
|
|
11263
11295
|
/** TODO: docs */
|
|
11264
11296
|
struct$1([
|
|
@@ -11271,7 +11303,13 @@ struct$1([
|
|
|
11271
11303
|
struct$1([u8$1('instruction')]);
|
|
11272
11304
|
|
|
11273
11305
|
/** TODO: docs */
|
|
11274
|
-
struct$1([u8$1('instruction'), u64$
|
|
11306
|
+
struct$1([u8$1('instruction'), u64$2('amount')]);
|
|
11307
|
+
|
|
11308
|
+
/** TODO: docs */
|
|
11309
|
+
struct$1([
|
|
11310
|
+
u8$1('instruction'),
|
|
11311
|
+
new COptionU64Layout('amount'),
|
|
11312
|
+
]);
|
|
11275
11313
|
|
|
11276
11314
|
var GroupMemberPointerInstruction;
|
|
11277
11315
|
(function (GroupMemberPointerInstruction) {
|
|
@@ -11282,14 +11320,14 @@ struct$1([
|
|
|
11282
11320
|
// prettier-ignore
|
|
11283
11321
|
u8$1('instruction'),
|
|
11284
11322
|
u8$1('groupMemberPointerInstruction'),
|
|
11285
|
-
publicKey$
|
|
11286
|
-
publicKey$
|
|
11323
|
+
publicKey$5('authority'),
|
|
11324
|
+
publicKey$5('memberAddress'),
|
|
11287
11325
|
]);
|
|
11288
11326
|
struct$1([
|
|
11289
11327
|
// prettier-ignore
|
|
11290
11328
|
u8$1('instruction'),
|
|
11291
11329
|
u8$1('groupMemberPointerInstruction'),
|
|
11292
|
-
publicKey$
|
|
11330
|
+
publicKey$5('memberAddress'),
|
|
11293
11331
|
]);
|
|
11294
11332
|
|
|
11295
11333
|
var GroupPointerInstruction;
|
|
@@ -11301,21 +11339,21 @@ struct$1([
|
|
|
11301
11339
|
// prettier-ignore
|
|
11302
11340
|
u8$1('instruction'),
|
|
11303
11341
|
u8$1('groupPointerInstruction'),
|
|
11304
|
-
publicKey$
|
|
11305
|
-
publicKey$
|
|
11342
|
+
publicKey$5('authority'),
|
|
11343
|
+
publicKey$5('groupAddress'),
|
|
11306
11344
|
]);
|
|
11307
11345
|
struct$1([
|
|
11308
11346
|
// prettier-ignore
|
|
11309
11347
|
u8$1('instruction'),
|
|
11310
11348
|
u8$1('groupPointerInstruction'),
|
|
11311
|
-
publicKey$
|
|
11349
|
+
publicKey$5('groupAddress'),
|
|
11312
11350
|
]);
|
|
11313
11351
|
|
|
11314
11352
|
/** TODO: docs */
|
|
11315
11353
|
struct$1([
|
|
11316
11354
|
u8$1('instruction'),
|
|
11317
11355
|
u8$1('decimals'),
|
|
11318
|
-
publicKey$
|
|
11356
|
+
publicKey$5('mintAuthority'),
|
|
11319
11357
|
new COptionPublicKeyLayout('freezeAuthority'),
|
|
11320
11358
|
]);
|
|
11321
11359
|
|
|
@@ -11328,7 +11366,7 @@ struct$1([
|
|
|
11328
11366
|
u8$1('instruction'),
|
|
11329
11367
|
u8$1('interestBearingMintInstruction'),
|
|
11330
11368
|
// TODO: Make this an optional public key
|
|
11331
|
-
publicKey$
|
|
11369
|
+
publicKey$5('rateAuthority'),
|
|
11332
11370
|
s16('rate'),
|
|
11333
11371
|
]);
|
|
11334
11372
|
struct$1([
|
|
@@ -11346,14 +11384,14 @@ struct$1([
|
|
|
11346
11384
|
// prettier-ignore
|
|
11347
11385
|
u8$1('instruction'),
|
|
11348
11386
|
u8$1('metadataPointerInstruction'),
|
|
11349
|
-
publicKey$
|
|
11350
|
-
publicKey$
|
|
11387
|
+
publicKey$5('authority'),
|
|
11388
|
+
publicKey$5('metadataAddress'),
|
|
11351
11389
|
]);
|
|
11352
11390
|
struct$1([
|
|
11353
11391
|
// prettier-ignore
|
|
11354
11392
|
u8$1('instruction'),
|
|
11355
11393
|
u8$1('metadataPointerInstruction'),
|
|
11356
|
-
publicKey$
|
|
11394
|
+
publicKey$5('metadataAddress'),
|
|
11357
11395
|
]);
|
|
11358
11396
|
|
|
11359
11397
|
var Field;
|
|
@@ -11405,14 +11443,37 @@ function unpack(buffer) {
|
|
|
11405
11443
|
};
|
|
11406
11444
|
}
|
|
11407
11445
|
|
|
11446
|
+
var PermissionedBurnInstruction;
|
|
11447
|
+
(function (PermissionedBurnInstruction) {
|
|
11448
|
+
PermissionedBurnInstruction[PermissionedBurnInstruction["Initialize"] = 0] = "Initialize";
|
|
11449
|
+
PermissionedBurnInstruction[PermissionedBurnInstruction["Burn"] = 1] = "Burn";
|
|
11450
|
+
PermissionedBurnInstruction[PermissionedBurnInstruction["BurnChecked"] = 2] = "BurnChecked";
|
|
11451
|
+
})(PermissionedBurnInstruction || (PermissionedBurnInstruction = {}));
|
|
11452
|
+
struct$1([
|
|
11453
|
+
u8$1('instruction'),
|
|
11454
|
+
u8$1('permissionedBurnInstruction'),
|
|
11455
|
+
publicKey$5('authority'),
|
|
11456
|
+
]);
|
|
11457
|
+
struct$1([
|
|
11458
|
+
u8$1('instruction'),
|
|
11459
|
+
u8$1('permissionedBurnInstruction'),
|
|
11460
|
+
u64$2('amount'),
|
|
11461
|
+
]);
|
|
11462
|
+
struct$1([
|
|
11463
|
+
u8$1('instruction'),
|
|
11464
|
+
u8$1('permissionedBurnInstruction'),
|
|
11465
|
+
u64$2('amount'),
|
|
11466
|
+
u8$1('decimals'),
|
|
11467
|
+
]);
|
|
11468
|
+
|
|
11408
11469
|
struct$1([
|
|
11409
11470
|
u8$1('instruction'),
|
|
11410
|
-
publicKey$
|
|
11471
|
+
publicKey$5('owner'),
|
|
11411
11472
|
]);
|
|
11412
11473
|
|
|
11413
11474
|
struct$1([
|
|
11414
11475
|
u8$1('instruction'),
|
|
11415
|
-
publicKey$
|
|
11476
|
+
publicKey$5('owner'),
|
|
11416
11477
|
]);
|
|
11417
11478
|
|
|
11418
11479
|
/** The struct that represents the instruction data as it is read by the program */
|
|
@@ -11434,9 +11495,46 @@ struct$1([
|
|
|
11434
11495
|
/** TODO: docs */
|
|
11435
11496
|
struct$1([
|
|
11436
11497
|
u8$1('instruction'),
|
|
11437
|
-
publicKey$
|
|
11498
|
+
publicKey$5('delegate'),
|
|
11438
11499
|
]);
|
|
11439
11500
|
|
|
11501
|
+
const encodeDecode$1 = (layout) => {
|
|
11502
|
+
const decode = layout.decode.bind(layout);
|
|
11503
|
+
const encode = layout.encode.bind(layout);
|
|
11504
|
+
return { decode, encode };
|
|
11505
|
+
};
|
|
11506
|
+
|
|
11507
|
+
const bigInt = (length) => (property) => {
|
|
11508
|
+
const layout = blob$1(length, property);
|
|
11509
|
+
const { encode, decode } = encodeDecode$1(layout);
|
|
11510
|
+
const bigIntLayout = layout;
|
|
11511
|
+
bigIntLayout.decode = (buffer, offset) => {
|
|
11512
|
+
const src = decode(buffer, offset);
|
|
11513
|
+
return toBigIntLE_1(Buffer.from(src));
|
|
11514
|
+
};
|
|
11515
|
+
bigIntLayout.encode = (bigInt, buffer, offset) => {
|
|
11516
|
+
const src = toBufferLE_1(bigInt, length);
|
|
11517
|
+
return encode(src, buffer, offset);
|
|
11518
|
+
};
|
|
11519
|
+
return bigIntLayout;
|
|
11520
|
+
};
|
|
11521
|
+
const u64$1 = bigInt(8);
|
|
11522
|
+
|
|
11523
|
+
const publicKey$4 = (property) => {
|
|
11524
|
+
const layout = blob$1(32, property);
|
|
11525
|
+
const { encode, decode } = encodeDecode$1(layout);
|
|
11526
|
+
const publicKeyLayout = layout;
|
|
11527
|
+
publicKeyLayout.decode = (buffer, offset) => {
|
|
11528
|
+
const src = decode(buffer, offset);
|
|
11529
|
+
return new PublicKey(src);
|
|
11530
|
+
};
|
|
11531
|
+
publicKeyLayout.encode = (publicKey, buffer, offset) => {
|
|
11532
|
+
const src = publicKey.toBuffer();
|
|
11533
|
+
return encode(src, buffer, offset);
|
|
11534
|
+
};
|
|
11535
|
+
return publicKeyLayout;
|
|
11536
|
+
};
|
|
11537
|
+
|
|
11440
11538
|
var nodeCache = {exports: {}};
|
|
11441
11539
|
|
|
11442
11540
|
var node_cache = {exports: {}};
|
|
@@ -13096,15 +13194,13 @@ function getTokenInfo(connection_1, tokenAddress_1) {
|
|
|
13096
13194
|
}
|
|
13097
13195
|
// fetcher encapsulates the actual work and is stored in cache when useCache is true
|
|
13098
13196
|
const fetcher = (() => __awaiter(this, void 0, void 0, function* () {
|
|
13099
|
-
var _a;
|
|
13100
13197
|
const [pda] = getTokenMetadataAddress(tokenAddress, TOKEN_METADATA_PROGRAM_ID);
|
|
13101
13198
|
const [tokenAccount, pdaAccount] = yield connection.getMultipleAccountsInfo([tokenAddress, pda]);
|
|
13102
13199
|
if (!tokenAccount || (tokenAccount === null || tokenAccount === void 0 ? void 0 : tokenAccount.lamports) === 0) {
|
|
13103
13200
|
return null;
|
|
13104
13201
|
}
|
|
13105
13202
|
const mint2022 = unpackMint(tokenAddress, tokenAccount, tokenAccount.owner);
|
|
13106
|
-
const
|
|
13107
|
-
const tokenMetaBuf = extTypes.includes(ExtensionType.TokenMetadata)
|
|
13203
|
+
const tokenMetaBuf = mint2022.tlvData.length
|
|
13108
13204
|
? getExtensionData(ExtensionType.TokenMetadata, mint2022.tlvData)
|
|
13109
13205
|
: null;
|
|
13110
13206
|
if (tokenMetaBuf) {
|
|
@@ -13118,24 +13214,6 @@ function getTokenInfo(connection_1, tokenAddress_1) {
|
|
|
13118
13214
|
tokenProgram: tokenAccount.owner,
|
|
13119
13215
|
};
|
|
13120
13216
|
}
|
|
13121
|
-
if (extTypes.includes(ExtensionType.MetadataPointer)) {
|
|
13122
|
-
const mpState = getMetadataPointerState(mint2022);
|
|
13123
|
-
if ((mpState === null || mpState === void 0 ? void 0 : mpState.metadataAddress) &&
|
|
13124
|
-
mpState.metadataAddress.equals(tokenAddress)) {
|
|
13125
|
-
const inlineMetaBuf = getExtensionData(ExtensionType.TokenMetadata, mint2022.tlvData);
|
|
13126
|
-
if (inlineMetaBuf) {
|
|
13127
|
-
const meta = unpack(inlineMetaBuf);
|
|
13128
|
-
return {
|
|
13129
|
-
address: tokenAddress,
|
|
13130
|
-
decimals: mint2022.decimals,
|
|
13131
|
-
name: meta.name,
|
|
13132
|
-
symbol: meta.symbol,
|
|
13133
|
-
json: meta.uri,
|
|
13134
|
-
tokenProgram: tokenAccount.owner,
|
|
13135
|
-
};
|
|
13136
|
-
}
|
|
13137
|
-
}
|
|
13138
|
-
}
|
|
13139
13217
|
// parse token account
|
|
13140
13218
|
// mint_authority - coption(pubkey) = 36
|
|
13141
13219
|
// supply - u64 = 8
|
|
@@ -13333,9 +13411,9 @@ function getAssocSPLWalletBalance(connection, originalWallet, tokenMint) {
|
|
|
13333
13411
|
* Returns balance of specified wallets. null if account doesn't exist
|
|
13334
13412
|
* @param wallet spl-tokens wallet address
|
|
13335
13413
|
*/
|
|
13336
|
-
function getWalletsBalances(connection, wallets) {
|
|
13414
|
+
function getWalletsBalances(connection, wallets, commitment) {
|
|
13337
13415
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13338
|
-
const infos = yield connection.getMultipleAccountsInfo(wallets.map((w) => new PublicKey(w)),
|
|
13416
|
+
const infos = yield connection.getMultipleAccountsInfo(wallets.map((w) => new PublicKey(w)), commitment);
|
|
13339
13417
|
const results = [];
|
|
13340
13418
|
for (const info of infos) {
|
|
13341
13419
|
if (!info || info.lamports === 0) {
|
|
@@ -30750,16 +30828,16 @@ function generateLogsParsingRegex() {
|
|
|
30750
30828
|
"Program consumption: {} units remaining"
|
|
30751
30829
|
];
|
|
30752
30830
|
const prepareLineForRegex = (l) => l.replaceAll("{}", ".*").replaceAll("(", "\\(").replaceAll(")", "\\)").replaceAll("]", "\\]").replaceAll("[", "\\[");
|
|
30753
|
-
const regexTemplate = `\
|
|
30754
|
-
(?<logTruncated>^Log truncated$)|\
|
|
30755
|
-
(?<programInvoke>^Program (?<invokeProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) invoke \\[(?<level>\\d+)\\]$)|\
|
|
30756
|
-
(?<programSuccessResult>^Program (?<successResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) success$)|\
|
|
30757
|
-
(?<programFailedResult>^Program (?<failedResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) failed: (?<failedResultErr>.*)$)|\
|
|
30758
|
-
(?<programCompleteFailedResult>^Program failed to complete: (?<failedCompleteError>.*)$)|\
|
|
30759
|
-
(?<programLog>^Program log: (?<logMessage>.*)$)|\
|
|
30760
|
-
(?<programData>^Program data: (?<data>.*)$)|\
|
|
30761
|
-
(?<programConsumed>^Program (?<consumedProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) consumed (?<consumedComputeUnits>\\d*) of (?<allComputedUnits>\\d*) compute units$)|\
|
|
30762
|
-
(?<programReturn>^Program return: (?<returnProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) (?<returnMessage>.*)$)|\
|
|
30831
|
+
const regexTemplate = `\
|
|
30832
|
+
(?<logTruncated>^Log truncated$)|\
|
|
30833
|
+
(?<programInvoke>^Program (?<invokeProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) invoke \\[(?<level>\\d+)\\]$)|\
|
|
30834
|
+
(?<programSuccessResult>^Program (?<successResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) success$)|\
|
|
30835
|
+
(?<programFailedResult>^Program (?<failedResultProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) failed: (?<failedResultErr>.*)$)|\
|
|
30836
|
+
(?<programCompleteFailedResult>^Program failed to complete: (?<failedCompleteError>.*)$)|\
|
|
30837
|
+
(?<programLog>^Program log: (?<logMessage>.*)$)|\
|
|
30838
|
+
(?<programData>^Program data: (?<data>.*)$)|\
|
|
30839
|
+
(?<programConsumed>^Program (?<consumedProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) consumed (?<consumedComputeUnits>\\d*) of (?<allComputedUnits>\\d*) compute units$)|\
|
|
30840
|
+
(?<programReturn>^Program return: (?<returnProgramId>[1-9A-HJ-NP-Za-km-z]{32,}) (?<returnMessage>.*)$)|\
|
|
30763
30841
|
(?<errorMessage>^(${knownMsgs.map(prepareLineForRegex).join("|")})$)`;
|
|
30764
30842
|
return new RegExp(regexTemplate, "s");
|
|
30765
30843
|
}
|