@gala-chain/gala-core-sdk 1.1.0-beta.9 → 1.2.0-beta.1
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/README.md +48 -2
- package/dist/browser/classes/error_catalog.js +1 -1
- package/dist/browser/classes/error_catalog.js.map +1 -1
- package/dist/browser/classes/error_phase_table.js +1 -1
- package/dist/browser/classes/error_phase_table.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/reads/gateway_reads.js +1 -1
- package/dist/browser/reads/nft_collections.js +2 -0
- package/dist/browser/reads/nft_collections.js.map +1 -0
- package/dist/browser/reads/nft_fees.js +2 -0
- package/dist/browser/reads/nft_fees.js.map +1 -0
- package/dist/browser/reads/request.js +1 -1
- package/dist/browser/reads/request.js.map +1 -1
- package/dist/browser/utils/transport.js +1 -1
- package/dist/browser/version.js +1 -1
- package/dist/browser/version.js.map +1 -1
- package/dist/browser/writes/gateway_writes.js +1 -1
- package/dist/browser/writes/gateway_writes.js.map +1 -1
- package/dist/browser/writes/nft.js +2 -0
- package/dist/browser/writes/nft.js.map +1 -0
- package/dist/browser/writes/nft_fee.js +2 -0
- package/dist/browser/writes/nft_fee.js.map +1 -0
- package/dist/browser/writes/submit.js +1 -1
- package/dist/browser/writes/submit.js.map +1 -1
- package/dist/browser/writes/types.js.map +1 -1
- package/dist/index.cjs +716 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +255 -3
- package/dist/index.d.ts +255 -3
- package/dist/index.mjs +709 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +32 -30
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,20 @@ const INVALID_TOKEN_REFERENCE_REASONS = [
|
|
|
85
85
|
"bad_instance"
|
|
86
86
|
];
|
|
87
87
|
/**
|
|
88
|
+
* Why an NFT read's, write's or fee quote's input is refused (`INVALID_NFT_INPUT.params.reason`).
|
|
89
|
+
* A token for the app to map to its own text.
|
|
90
|
+
*/
|
|
91
|
+
const INVALID_NFT_INPUT_REASONS = [
|
|
92
|
+
"not_a_string",
|
|
93
|
+
"empty",
|
|
94
|
+
"bad_characters",
|
|
95
|
+
"not_a_positive_whole_number",
|
|
96
|
+
"above_mint_limit",
|
|
97
|
+
"bad_public_key",
|
|
98
|
+
"bad_authorities",
|
|
99
|
+
"bad_collection_name"
|
|
100
|
+
];
|
|
101
|
+
/**
|
|
88
102
|
* The `GatewayWrites` options that are refused when missing or of the wrong type
|
|
89
103
|
* (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and
|
|
90
104
|
* `uniqueKeyPrefix` have codes of their own (`INVALID_WALLET_ADDRESS`, `INVALID_TIMEOUT`,
|
|
@@ -565,6 +579,14 @@ const GALA_ERROR_CATALOG = {
|
|
|
565
579
|
template: "The lock name must be a string (got a {valueType}).",
|
|
566
580
|
params: { valueType: "string" }
|
|
567
581
|
},
|
|
582
|
+
INVALID_NFT_INPUT: {
|
|
583
|
+
phase: "pre_send",
|
|
584
|
+
template: "Invalid NFT input {field}: {reason}.",
|
|
585
|
+
params: {
|
|
586
|
+
field: "string",
|
|
587
|
+
reason: INVALID_NFT_INPUT_REASONS
|
|
588
|
+
}
|
|
589
|
+
},
|
|
568
590
|
NO_TOKEN_NAME_RESOLVER: {
|
|
569
591
|
phase: "pre_send",
|
|
570
592
|
template: "The token name \"{tokenName}\" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.",
|
|
@@ -916,6 +938,7 @@ const GALA_ERROR_PHASE_BY_CODE = {
|
|
|
916
938
|
INVALID_TOKEN_BATCH: "pre_send",
|
|
917
939
|
INVALID_LOCK_EXPIRES: "pre_send",
|
|
918
940
|
INVALID_LOCK_NAME: "pre_send",
|
|
941
|
+
INVALID_NFT_INPUT: "pre_send",
|
|
919
942
|
NO_TOKEN_NAME_RESOLVER: "pre_send",
|
|
920
943
|
TOKEN_NAME_RESOLUTION_FAILED: "pre_send",
|
|
921
944
|
GATEWAY_WRITE_OUTCOME_UNKNOWN: "in_flight",
|
|
@@ -999,12 +1022,12 @@ const GALA_ERROR_PHASES = [
|
|
|
999
1022
|
* recognise each other's errors, which `instanceof` cannot do.
|
|
1000
1023
|
*/
|
|
1001
1024
|
const GALA_ERROR_BRAND = Symbol.for("@gala-chain/gala-core-sdk/error");
|
|
1002
|
-
function isRecord$
|
|
1025
|
+
function isRecord$7(value) {
|
|
1003
1026
|
return typeof value === "object" && value !== null;
|
|
1004
1027
|
}
|
|
1005
1028
|
/** True when `value` carries the SDK error brand (a real `GalaSDKError`, from any copy of the SDK). */
|
|
1006
1029
|
function hasGalaErrorBrand(value) {
|
|
1007
|
-
return isRecord$
|
|
1030
|
+
return isRecord$7(value) && value[GALA_ERROR_BRAND] === true;
|
|
1008
1031
|
}
|
|
1009
1032
|
/**
|
|
1010
1033
|
* True when `value` is an SDK error (it carries the brand) or a plain-object VIEW of one: a string
|
|
@@ -1020,7 +1043,7 @@ function hasGalaErrorBrand(value) {
|
|
|
1020
1043
|
*/
|
|
1021
1044
|
function isGalaErrorLike(value) {
|
|
1022
1045
|
if (hasGalaErrorBrand(value)) return true;
|
|
1023
|
-
return isRecord$
|
|
1046
|
+
return isRecord$7(value) && typeof value["code"] === "string" && isRecord$7(value["params"]) && !Array.isArray(value["params"]);
|
|
1024
1047
|
}
|
|
1025
1048
|
|
|
1026
1049
|
//#endregion
|
|
@@ -2729,12 +2752,12 @@ const TEXT_KEYS = [
|
|
|
2729
2752
|
];
|
|
2730
2753
|
/** Wallet errors nest their text at most a level or two deep; the bound also stops a cyclic object. */
|
|
2731
2754
|
const MAX_TEXT_DEPTH = 3;
|
|
2732
|
-
function isRecord$
|
|
2755
|
+
function isRecord$6(value) {
|
|
2733
2756
|
return typeof value === "object" && value !== null;
|
|
2734
2757
|
}
|
|
2735
2758
|
function textsOf(value, depth = 0) {
|
|
2736
2759
|
if (typeof value === "string") return [value];
|
|
2737
|
-
if (!isRecord$
|
|
2760
|
+
if (!isRecord$6(value) || depth >= MAX_TEXT_DEPTH) return [];
|
|
2738
2761
|
return TEXT_KEYS.flatMap((key) => textsOf(value[key], depth + 1));
|
|
2739
2762
|
}
|
|
2740
2763
|
function wordsADecline(text) {
|
|
@@ -2777,7 +2800,7 @@ function isWalletUserRejection(value) {
|
|
|
2777
2800
|
if (value.code === "SIGNING_FAILED") return value.params["reason"] === "user_rejected";
|
|
2778
2801
|
return !hasGalaErrorBrand(value) && REJECTION_CODES.includes(value.code);
|
|
2779
2802
|
}
|
|
2780
|
-
if (isRecord$
|
|
2803
|
+
if (isRecord$6(value)) {
|
|
2781
2804
|
if (REJECTION_CODES.includes(value["code"]) || value["name"] === REJECTION_NAME) return true;
|
|
2782
2805
|
}
|
|
2783
2806
|
return textsOf(value).some(wordsADecline);
|
|
@@ -2869,7 +2892,7 @@ async function signPreSendFor(signer, contractPath, method, dto) {
|
|
|
2869
2892
|
* fallback. It is the version in the default `User-Agent` (`GalaChain-SDK/<version>`) of every SDK
|
|
2870
2893
|
* request, whichever product SDK sends it.
|
|
2871
2894
|
*/
|
|
2872
|
-
const GALA_CORE_SDK_VERSION = "1.
|
|
2895
|
+
const GALA_CORE_SDK_VERSION = "1.2.0-beta.1";
|
|
2873
2896
|
|
|
2874
2897
|
//#endregion
|
|
2875
2898
|
//#region src/utils/transport.ts
|
|
@@ -2930,7 +2953,7 @@ function buildRequestHeaders(wire, parts = {}) {
|
|
|
2930
2953
|
entries.set(name.toLowerCase(), [name, value]);
|
|
2931
2954
|
}
|
|
2932
2955
|
};
|
|
2933
|
-
if ((wire === null || wire === void 0 ? void 0 : wire.userAgent) !== false) put({ "User-Agent": (wire === null || wire === void 0 ? void 0 : wire.userAgent) ?? `GalaChain-SDK/${"1.
|
|
2956
|
+
if ((wire === null || wire === void 0 ? void 0 : wire.userAgent) !== false) put({ "User-Agent": (wire === null || wire === void 0 ? void 0 : wire.userAgent) ?? `GalaChain-SDK/${"1.2.0-beta.1"}` });
|
|
2934
2957
|
put(parts.defaults);
|
|
2935
2958
|
put(wire === null || wire === void 0 ? void 0 : wire.headers);
|
|
2936
2959
|
if (parts.json === true && !entries.has("content-type")) put({ "Content-Type": "application/json" });
|
|
@@ -3033,7 +3056,7 @@ function hasHeaderGetter(headers) {
|
|
|
3033
3056
|
|
|
3034
3057
|
//#endregion
|
|
3035
3058
|
//#region src/utils/axios_requestor.ts
|
|
3036
|
-
function isRecord$
|
|
3059
|
+
function isRecord$5(value) {
|
|
3037
3060
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3038
3061
|
}
|
|
3039
3062
|
/**
|
|
@@ -3041,10 +3064,10 @@ function isRecord$3(value) {
|
|
|
3041
3064
|
* for ECONNREFUSED). That is a transport failure, not an HTTP answer.
|
|
3042
3065
|
*/
|
|
3043
3066
|
function isAxiosLikeResponse(value) {
|
|
3044
|
-
return isRecord$
|
|
3067
|
+
return isRecord$5(value) && typeof value["status"] === "number";
|
|
3045
3068
|
}
|
|
3046
3069
|
function readAxiosHeader(headers, name) {
|
|
3047
|
-
if (!isRecord$
|
|
3070
|
+
if (!isRecord$5(headers)) return null;
|
|
3048
3071
|
const getter = headers["get"];
|
|
3049
3072
|
if (typeof getter === "function") {
|
|
3050
3073
|
const value = getter.call(headers, name);
|
|
@@ -3125,16 +3148,16 @@ function httpRequestorFromAxios(instance, options) {
|
|
|
3125
3148
|
*/
|
|
3126
3149
|
function isTransportRejection(error, rejectOnHttpError) {
|
|
3127
3150
|
if (!rejectOnHttpError) return true;
|
|
3128
|
-
return isRecord$
|
|
3151
|
+
return isRecord$5(error) && error["isAxiosError"] === true && error["response"] === void 0;
|
|
3129
3152
|
}
|
|
3130
3153
|
|
|
3131
3154
|
//#endregion
|
|
3132
3155
|
//#region src/utils/ethers_provider.ts
|
|
3133
|
-
function isRecord$
|
|
3156
|
+
function isRecord$4(value) {
|
|
3134
3157
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3135
3158
|
}
|
|
3136
3159
|
function isTypedDataTypes(value) {
|
|
3137
|
-
return isRecord$
|
|
3160
|
+
return isRecord$4(value) && Object.values(value).every((fields) => Array.isArray(fields) && fields.every((field) => isRecord$4(field) && typeof field["name"] === "string" && typeof field["type"] === "string"));
|
|
3138
3161
|
}
|
|
3139
3162
|
function malformed(method) {
|
|
3140
3163
|
return new GalaSDKError("MALFORMED_WALLET_REQUEST", { method });
|
|
@@ -3148,9 +3171,9 @@ function readTypedDataRequest(params) {
|
|
|
3148
3171
|
} catch {
|
|
3149
3172
|
throw malformed("eth_signTypedData_v4");
|
|
3150
3173
|
}
|
|
3151
|
-
if (!isRecord$
|
|
3174
|
+
if (!isRecord$4(payload)) throw malformed("eth_signTypedData_v4");
|
|
3152
3175
|
const { domain, types, message } = payload;
|
|
3153
|
-
if (!isRecord$
|
|
3176
|
+
if (!isRecord$4(domain) || !isTypedDataTypes(types) || !isRecord$4(message)) throw malformed("eth_signTypedData_v4");
|
|
3154
3177
|
return {
|
|
3155
3178
|
domain,
|
|
3156
3179
|
types: stripEip712DomainType(types),
|
|
@@ -3279,7 +3302,7 @@ const FAILURE_OUTCOMES = [
|
|
|
3279
3302
|
|
|
3280
3303
|
//#endregion
|
|
3281
3304
|
//#region src/utils/failure_view.ts
|
|
3282
|
-
function isRecord$
|
|
3305
|
+
function isRecord$3(value) {
|
|
3283
3306
|
return typeof value === "object" && value !== null;
|
|
3284
3307
|
}
|
|
3285
3308
|
/**
|
|
@@ -3297,12 +3320,12 @@ function isRecord$1(value) {
|
|
|
3297
3320
|
* ```
|
|
3298
3321
|
*/
|
|
3299
3322
|
function toFailureView(value) {
|
|
3300
|
-
if (!isRecord$
|
|
3323
|
+
if (!isRecord$3(value)) return void 0;
|
|
3301
3324
|
const { code, params, status, phase, uniqueKey, write, outcome, retryable, shadow, notFound } = value;
|
|
3302
3325
|
if (typeof code !== "string" || code === "") return void 0;
|
|
3303
3326
|
return {
|
|
3304
3327
|
code,
|
|
3305
|
-
params: isRecord$
|
|
3328
|
+
params: isRecord$3(params) && !Array.isArray(params) ? params : void 0,
|
|
3306
3329
|
status: typeof status === "number" && Number.isFinite(status) ? status : void 0,
|
|
3307
3330
|
phase: GALA_ERROR_PHASES.find((known) => known === phase),
|
|
3308
3331
|
uniqueKey: typeof uniqueKey === "string" && uniqueKey !== "" ? uniqueKey : void 0,
|
|
@@ -3763,10 +3786,315 @@ function unlockTokenDto(owner, tokens, uniqueKey, name) {
|
|
|
3763
3786
|
};
|
|
3764
3787
|
}
|
|
3765
3788
|
|
|
3789
|
+
//#endregion
|
|
3790
|
+
//#region src/writes/nft.ts
|
|
3791
|
+
/**
|
|
3792
|
+
* The NFT methods of GalaChain's token contract that `GatewayWrites` signs and submits, as a closed
|
|
3793
|
+
* set: claim a collection name (`GrantNftCollectionAuthorization`), create the NFT collection's
|
|
3794
|
+
* token class (`CreateNftCollection`), mint NFTs, granting the minter its own mint allowance in
|
|
3795
|
+
* the same transaction (`MintTokenWithAllowance`) or against an allowance it already holds
|
|
3796
|
+
* (`MintToken`).
|
|
3797
|
+
*/
|
|
3798
|
+
const NFT_WRITE_METHODS = [
|
|
3799
|
+
"GrantNftCollectionAuthorization",
|
|
3800
|
+
"CreateNftCollection",
|
|
3801
|
+
"MintTokenWithAllowance",
|
|
3802
|
+
"MintToken"
|
|
3803
|
+
];
|
|
3804
|
+
/** The most NFTs one mint may create (the chain's `MintTokenDto.MAX_NFT_MINT_SIZE`). */
|
|
3805
|
+
const NFT_MINT_LIMIT = 1e3;
|
|
3806
|
+
/** The `additionalKey` an NFT token class carries when its creator names none (GalaChain's `none`). */
|
|
3807
|
+
const NFT_DEFAULT_ADDITIONAL_KEY = "none";
|
|
3808
|
+
function refuse(field, reason) {
|
|
3809
|
+
return new GalaSDKError("INVALID_NFT_INPUT", {
|
|
3810
|
+
field,
|
|
3811
|
+
reason
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
/** True when `value` holds an ASCII or C1 control character (the NUL of chain composite keys among them). */
|
|
3815
|
+
function hasControlCharacter(value) {
|
|
3816
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
3817
|
+
const code = value.charCodeAt(index);
|
|
3818
|
+
if (code <= 31 || code >= 127 && code <= 159) return true;
|
|
3819
|
+
}
|
|
3820
|
+
return false;
|
|
3821
|
+
}
|
|
3822
|
+
/**
|
|
3823
|
+
* One part of a token class key (collection, category, type, additionalKey): a non-empty string
|
|
3824
|
+
* with no control character (the chain's composite keys are NUL-separated), no `|` (the key's own
|
|
3825
|
+
* separator) and no surrounding whitespace. Returned exactly as written, never trimmed.
|
|
3826
|
+
*
|
|
3827
|
+
* @throws GalaSDKError `INVALID_NFT_INPUT`.
|
|
3828
|
+
*/
|
|
3829
|
+
function nftClassPart(value, field) {
|
|
3830
|
+
if (typeof value !== "string") throw refuse(field, "not_a_string");
|
|
3831
|
+
if (value.trim() === "") throw refuse(field, "empty");
|
|
3832
|
+
if (value.trim() !== value || value.includes("|") || hasControlCharacter(value)) throw refuse(field, "bad_characters");
|
|
3833
|
+
return value;
|
|
3834
|
+
}
|
|
3835
|
+
/** A non-empty free-text field (name, description, image, ...), exactly as written. */
|
|
3836
|
+
function nftText(value, field) {
|
|
3837
|
+
if (typeof value !== "string") throw refuse(field, "not_a_string");
|
|
3838
|
+
if (value.trim() === "") throw refuse(field, "empty");
|
|
3839
|
+
return value;
|
|
3840
|
+
}
|
|
3841
|
+
/** A string that may be empty (the symbol). */
|
|
3842
|
+
function nftString(value, field) {
|
|
3843
|
+
if (typeof value !== "string") throw refuse(field, "not_a_string");
|
|
3844
|
+
return value;
|
|
3845
|
+
}
|
|
3846
|
+
const WHOLE_NUMBER = /^[1-9][0-9]{0,37}$/u;
|
|
3847
|
+
/**
|
|
3848
|
+
* A positive whole number written as a decimal string (no sign, fraction, exponent, separators or
|
|
3849
|
+
* leading zero), returned as written. A JS number is refused: the chain receives strings.
|
|
3850
|
+
*/
|
|
3851
|
+
function nftWholeNumber(value, field) {
|
|
3852
|
+
if (typeof value !== "string" || !WHOLE_NUMBER.test(value)) throw refuse(field, "not_a_positive_whole_number");
|
|
3853
|
+
return value;
|
|
3854
|
+
}
|
|
3855
|
+
/** The quantity of a mint: a positive whole number of at most {@link NFT_MINT_LIMIT}. */
|
|
3856
|
+
function nftMintQuantity(value, field) {
|
|
3857
|
+
const quantity = nftWholeNumber(value, field);
|
|
3858
|
+
if (new bignumber_js.default(quantity).isGreaterThan(1e3)) throw refuse(field, "above_mint_limit");
|
|
3859
|
+
return quantity;
|
|
3860
|
+
}
|
|
3861
|
+
/** The token class a write names, every part checked; `additionalKey` defaults to `none`. */
|
|
3862
|
+
function nftTokenClass(input) {
|
|
3863
|
+
return {
|
|
3864
|
+
collection: nftClassPart(input.collection, "collection"),
|
|
3865
|
+
category: nftClassPart(input.category, "category"),
|
|
3866
|
+
type: nftClassPart(input.type, "type"),
|
|
3867
|
+
additionalKey: nftClassPart(input.additionalKey ?? "none", "additionalKey")
|
|
3868
|
+
};
|
|
3869
|
+
}
|
|
3870
|
+
/** The authorities of a create: one or more user references, each in its one gateway spelling. */
|
|
3871
|
+
function nftAuthorities(value) {
|
|
3872
|
+
if (!Array.isArray(value) || value.length === 0) throw refuse("authorities", "bad_authorities");
|
|
3873
|
+
return value.map((authority, index) => galaChainUserRef(authority, `authorities[${index}]`));
|
|
3874
|
+
}
|
|
3875
|
+
const PUBLIC_KEY = /^(?:0x)?(?:(?:02|03)[0-9a-fA-F]{64}|04[0-9a-fA-F]{128})$/u;
|
|
3876
|
+
/**
|
|
3877
|
+
* The public key a DryRun simulates the caller as: a secp256k1 key in hex, compressed (33 bytes) or
|
|
3878
|
+
* uncompressed (65 bytes), with or without `0x`. The chain refuses a DryRun that names no caller.
|
|
3879
|
+
*/
|
|
3880
|
+
function nftCallerPublicKey(value) {
|
|
3881
|
+
if (typeof value !== "string" || !PUBLIC_KEY.test(value)) throw refuse("callerPublicKey", "bad_public_key");
|
|
3882
|
+
return value;
|
|
3883
|
+
}
|
|
3884
|
+
/** The unsigned `GrantNftCollectionAuthorization` DTO. */
|
|
3885
|
+
function claimNftCollectionDto(collection, authorizedUser, uniqueKey) {
|
|
3886
|
+
return {
|
|
3887
|
+
collection,
|
|
3888
|
+
authorizedUser,
|
|
3889
|
+
uniqueKey
|
|
3890
|
+
};
|
|
3891
|
+
}
|
|
3892
|
+
/** The unsigned `CreateNftCollection` DTO: the fields the caller gave, none the caller left out. */
|
|
3893
|
+
function createNftCollectionDto(tokenClass, fields, uniqueKey) {
|
|
3894
|
+
return {
|
|
3895
|
+
...tokenClass,
|
|
3896
|
+
name: fields.name,
|
|
3897
|
+
symbol: fields.symbol,
|
|
3898
|
+
description: fields.description,
|
|
3899
|
+
image: fields.image,
|
|
3900
|
+
maxSupply: fields.maxSupply,
|
|
3901
|
+
...fields.maxCapacity === void 0 ? {} : { maxCapacity: fields.maxCapacity },
|
|
3902
|
+
...fields.metadataAddress === void 0 ? {} : { metadataAddress: fields.metadataAddress },
|
|
3903
|
+
...fields.contractAddress === void 0 ? {} : { contractAddress: fields.contractAddress },
|
|
3904
|
+
...fields.rarity === void 0 ? {} : { rarity: fields.rarity },
|
|
3905
|
+
...fields.authorities === void 0 ? {} : { authorities: [...fields.authorities] },
|
|
3906
|
+
uniqueKey
|
|
3907
|
+
};
|
|
3908
|
+
}
|
|
3909
|
+
/**
|
|
3910
|
+
* The unsigned mint DTO. `MintTokenWithAllowance` names instance `"0"` (the allowance it grants
|
|
3911
|
+
* itself covers the class's mint, not one NFT); `MintToken` carries no instance.
|
|
3912
|
+
*/
|
|
3913
|
+
function mintNftDto(method, tokenClass, owner, quantity, uniqueKey) {
|
|
3914
|
+
return {
|
|
3915
|
+
tokenClass,
|
|
3916
|
+
owner,
|
|
3917
|
+
...method === "MintTokenWithAllowance" ? { tokenInstance: "0" } : {},
|
|
3918
|
+
quantity,
|
|
3919
|
+
uniqueKey
|
|
3920
|
+
};
|
|
3921
|
+
}
|
|
3922
|
+
function isRecord$2(value) {
|
|
3923
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3924
|
+
}
|
|
3925
|
+
/** The error for a write GalaChain accepted whose answer does not say what the write did. */
|
|
3926
|
+
function unreadable(method, uniqueKey, body) {
|
|
3927
|
+
return new GalaSDKError("GATEWAY_RESPONSE_INVALID", { method }, {
|
|
3928
|
+
body,
|
|
3929
|
+
uniqueKey
|
|
3930
|
+
});
|
|
3931
|
+
}
|
|
3932
|
+
function sameClass(value, tokenClass) {
|
|
3933
|
+
return value["collection"] === tokenClass.collection && value["category"] === tokenClass.category && value["type"] === tokenClass.type && value["additionalKey"] === tokenClass.additionalKey;
|
|
3934
|
+
}
|
|
3935
|
+
/**
|
|
3936
|
+
* The collection and authorized users a claim answered. Fails closed: an answer for another
|
|
3937
|
+
* collection, or one that authorizes nobody, is not the claim that was sent.
|
|
3938
|
+
*/
|
|
3939
|
+
function claimedCollection(receipt, collection) {
|
|
3940
|
+
const data = receipt.data;
|
|
3941
|
+
const users = isRecord$2(data) ? data["authorizedUsers"] : void 0;
|
|
3942
|
+
if (!isRecord$2(data) || data["collection"] !== collection || !Array.isArray(users) || users.length === 0 || !users.every((user) => typeof user === "string")) throw unreadable(receipt.method, receipt.uniqueKey, receipt.body);
|
|
3943
|
+
return {
|
|
3944
|
+
...receipt,
|
|
3945
|
+
collection,
|
|
3946
|
+
authorizedUsers: users
|
|
3947
|
+
};
|
|
3948
|
+
}
|
|
3949
|
+
/** The token class a create answered; an answer naming another class is not the create that was sent. */
|
|
3950
|
+
function createdTokenClass(receipt, tokenClass) {
|
|
3951
|
+
const data = receipt.data;
|
|
3952
|
+
if (!isRecord$2(data) || !sameClass(data, tokenClass)) throw unreadable(receipt.method, receipt.uniqueKey, receipt.body);
|
|
3953
|
+
return {
|
|
3954
|
+
...receipt,
|
|
3955
|
+
tokenClass: { ...tokenClass }
|
|
3956
|
+
};
|
|
3957
|
+
}
|
|
3958
|
+
const INSTANCE_ID = /^[0-9]+$/u;
|
|
3959
|
+
/**
|
|
3960
|
+
* The NFT instances a mint answered, never synthesized: as many as were asked for, each of the
|
|
3961
|
+
* class that was named, each with a whole-number instance, none twice.
|
|
3962
|
+
*/
|
|
3963
|
+
function mintedInstances(receipt, tokenClass, quantity) {
|
|
3964
|
+
const data = receipt.data;
|
|
3965
|
+
const instances = [];
|
|
3966
|
+
if (Array.isArray(data)) for (const item of data) {
|
|
3967
|
+
const instance = isRecord$2(item) ? item["instance"] : void 0;
|
|
3968
|
+
if (!isRecord$2(item) || !sameClass(item, tokenClass) || typeof instance !== "string") break;
|
|
3969
|
+
if (!INSTANCE_ID.test(instance)) break;
|
|
3970
|
+
instances.push({
|
|
3971
|
+
...tokenClass,
|
|
3972
|
+
instance
|
|
3973
|
+
});
|
|
3974
|
+
}
|
|
3975
|
+
if (!Array.isArray(data) || instances.length !== data.length || instances.length !== Number(quantity) || new Set(instances.map((key) => key.instance)).size !== instances.length) throw unreadable(receipt.method, receipt.uniqueKey, receipt.body);
|
|
3976
|
+
return {
|
|
3977
|
+
...receipt,
|
|
3978
|
+
tokenInstances: instances
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
//#endregion
|
|
3983
|
+
//#region src/reads/request.ts
|
|
3984
|
+
/** The chaincode contract each read method belongs to (part of its URL). */
|
|
3985
|
+
const CONTRACT_OF = {
|
|
3986
|
+
FetchBalances: "token-contract",
|
|
3987
|
+
FetchTokenClasses: "token-contract",
|
|
3988
|
+
FetchTokenClassesWithSupply: "token-contract",
|
|
3989
|
+
FetchTokenClassesWithPagination: "token-contract",
|
|
3990
|
+
FetchNftCollectionAuthorizationsWithPagination: "token-contract",
|
|
3991
|
+
GetPublicKey: "public-key-contract"
|
|
3992
|
+
};
|
|
3993
|
+
/**
|
|
3994
|
+
* Methods whose successful answer carries no `Status`: the connect-api GalaChain proxies answer
|
|
3995
|
+
* `GetPublicKey` with `{ Data: { publicKey } }` only (recorded 2026-10-14, prod and stage,
|
|
3996
|
+
* `tests/fixtures/public-key-recorded.json`). A `Status` they do send is still checked.
|
|
3997
|
+
*/
|
|
3998
|
+
const ANSWERED_WITHOUT_STATUS = /* @__PURE__ */ new Set(["GetPublicKey"]);
|
|
3999
|
+
/**
|
|
4000
|
+
* The channel of a collection: `$MUSIC` (and `MUSIC`, any case) lives on the gateway's `music`
|
|
4001
|
+
* channel, every other collection (`$GMUSIC` included) on `asset`.
|
|
4002
|
+
*/
|
|
4003
|
+
function channelOf(collection) {
|
|
4004
|
+
return collection !== void 0 && /^\$?music$/iu.test(collection) ? "music" : "asset";
|
|
4005
|
+
}
|
|
4006
|
+
function isRecord$1(value) {
|
|
4007
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4008
|
+
}
|
|
4009
|
+
function stringField$2(record, key) {
|
|
4010
|
+
const value = record === null || record === void 0 ? void 0 : record[key];
|
|
4011
|
+
return typeof value === "string" ? value : "";
|
|
4012
|
+
}
|
|
4013
|
+
/**
|
|
4014
|
+
* The chain's error object of a refused answer: GalaChain's gateway nests it as
|
|
4015
|
+
* `{ error: { Status: 0, ErrorKey, Message, ErrorPayload }, message }`; an older answer carries
|
|
4016
|
+
* `Status` / `ErrorKey` / `Message` at the top.
|
|
4017
|
+
*/
|
|
4018
|
+
function chainErrorOf(body) {
|
|
4019
|
+
if (!isRecord$1(body)) return void 0;
|
|
4020
|
+
const nested = body["error"];
|
|
4021
|
+
return isRecord$1(nested) ? nested : body;
|
|
4022
|
+
}
|
|
4023
|
+
/**
|
|
4024
|
+
* POSTs one read and returns the chain's `Data`. Reads change nothing, so every failure is a READ's
|
|
4025
|
+
* (`error.write === false`) and a retry is always safe:
|
|
4026
|
+
*
|
|
4027
|
+
* - no answer: `REQUEST_TIMEOUT` / `TRANSPORT_ERROR`, both `write: false` (an app requestor's
|
|
4028
|
+
* own rejection passes through unchanged: it is the app's error); a body that broke off is
|
|
4029
|
+
* `TRANSPORT_ERROR`;
|
|
4030
|
+
* - a numeric top-level `Status` other than 1, in any HTTP status: `GATEWAY_READ_REJECTED`;
|
|
4031
|
+
* - any other non-2xx: `GATEWAY_HTTP_ERROR` (`params.status`; the chain's refusal is `error.body`);
|
|
4032
|
+
* - a 2xx that is not `{ Status: 1, Data }` (for `GetPublicKey`, whose answer carries no
|
|
4033
|
+
* `Status`, not `{ Data }`): `GATEWAY_READ_RESPONSE_INVALID`.
|
|
4034
|
+
*/
|
|
4035
|
+
async function readGateway(transport, method, body, channel = "asset") {
|
|
4036
|
+
const url = `${transport.gatewayBaseUrl}/api/${channel}/${CONTRACT_OF[method]}/${method}`;
|
|
4037
|
+
const response = await requestWithTimeout(transport.requestor, url, {
|
|
4038
|
+
method: "POST",
|
|
4039
|
+
headers: buildRequestHeaders(transport.wire, { json: true }),
|
|
4040
|
+
body: JSON.stringify(body)
|
|
4041
|
+
}, transport.timeoutMs, { write: false });
|
|
4042
|
+
let answer;
|
|
4043
|
+
try {
|
|
4044
|
+
answer = await readResponseBody(response);
|
|
4045
|
+
} catch (cause) {
|
|
4046
|
+
throw new GalaSDKError("TRANSPORT_ERROR", { url }, {
|
|
4047
|
+
url,
|
|
4048
|
+
cause,
|
|
4049
|
+
write: false
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
4052
|
+
return dataOf(method, url, response, answer);
|
|
4053
|
+
}
|
|
4054
|
+
/**
|
|
4055
|
+
* The chain's `Data` of a read-like answer, or the error for one that is not (see
|
|
4056
|
+
* {@link readGateway} for the codes). Also the reading of a signed DryRun answer, which changes
|
|
4057
|
+
* nothing either, so it names its own `method` (a string, not a read method).
|
|
4058
|
+
*/
|
|
4059
|
+
function dataOf(method, url, response, answer) {
|
|
4060
|
+
const context = {
|
|
4061
|
+
status: response.status,
|
|
4062
|
+
body: answer,
|
|
4063
|
+
url,
|
|
4064
|
+
write: false
|
|
4065
|
+
};
|
|
4066
|
+
const envelope = isRecord$1(answer) ? answer : void 0;
|
|
4067
|
+
const chainStatus = envelope === null || envelope === void 0 ? void 0 : envelope["Status"];
|
|
4068
|
+
if (typeof chainStatus === "number" && chainStatus !== 1) throw new GalaSDKError("GATEWAY_READ_REJECTED", {
|
|
4069
|
+
method,
|
|
4070
|
+
chainStatus,
|
|
4071
|
+
errorKey: stringField$2(envelope, "ErrorKey"),
|
|
4072
|
+
serverMessage: stringField$2(envelope, "Message")
|
|
4073
|
+
}, context);
|
|
4074
|
+
if (!response.ok) {
|
|
4075
|
+
const chainError = chainErrorOf(answer);
|
|
4076
|
+
throw new GalaSDKError("GATEWAY_HTTP_ERROR", {
|
|
4077
|
+
method,
|
|
4078
|
+
status: response.status,
|
|
4079
|
+
serverMessage: stringField$2(chainError, "Message") || stringField$2(envelope, "message")
|
|
4080
|
+
}, context);
|
|
4081
|
+
}
|
|
4082
|
+
const statusAccepted = chainStatus === 1 || chainStatus === void 0 && ANSWERED_WITHOUT_STATUS.has(method);
|
|
4083
|
+
if (envelope === void 0 || !statusAccepted || !("Data" in envelope)) throw new GalaSDKError("GATEWAY_READ_RESPONSE_INVALID", { method }, context);
|
|
4084
|
+
return envelope["Data"];
|
|
4085
|
+
}
|
|
4086
|
+
/** The error for a 2xx whose `Data` is not what `method` answers. */
|
|
4087
|
+
function invalidAnswer(method, data) {
|
|
4088
|
+
return new GalaSDKError("GATEWAY_READ_RESPONSE_INVALID", { method }, {
|
|
4089
|
+
body: data,
|
|
4090
|
+
write: false
|
|
4091
|
+
});
|
|
4092
|
+
}
|
|
4093
|
+
|
|
3766
4094
|
//#endregion
|
|
3767
4095
|
//#region src/writes/submit.ts
|
|
3768
4096
|
/** The contract every write of this module is sent to (its URL path and its `dtoOperation`). */
|
|
3769
|
-
const TOKEN_CONTRACT = "asset/token-contract";
|
|
4097
|
+
const TOKEN_CONTRACT$1 = "asset/token-contract";
|
|
3770
4098
|
/**
|
|
3771
4099
|
* The fields a signer may add next to the DTO: the signature and, for the wallet schemes, the
|
|
3772
4100
|
* personal-sign `prefix` and the EIP-712 `types` / `domain`. Nothing else: a signer that inserts a
|
|
@@ -3796,9 +4124,9 @@ function carriesExactlyTheDto(builtDto, signed) {
|
|
|
3796
4124
|
* `SIGNING_FAILED` (pre-send: nothing was transmitted, a retry is safe).
|
|
3797
4125
|
*/
|
|
3798
4126
|
async function signedPayload(signer, method, dto) {
|
|
3799
|
-
const operated = withDtoOperation(TOKEN_CONTRACT, method, dto);
|
|
4127
|
+
const operated = withDtoOperation(TOKEN_CONTRACT$1, method, dto);
|
|
3800
4128
|
const builtDto = serialize(operated);
|
|
3801
|
-
const signed = await signPreSendFor(signer, TOKEN_CONTRACT, method, operated);
|
|
4129
|
+
const signed = await signPreSendFor(signer, TOKEN_CONTRACT$1, method, operated);
|
|
3802
4130
|
let payload;
|
|
3803
4131
|
try {
|
|
3804
4132
|
payload = carriesExactlyTheDto(builtDto, signed) ? JSON.stringify(signed) : void 0;
|
|
@@ -3880,11 +4208,13 @@ function receiptOf(method, uniqueKey, url, response, body) {
|
|
|
3880
4208
|
};
|
|
3881
4209
|
const envelope = typeof body === "object" && body !== null && !Array.isArray(body) ? body : void 0;
|
|
3882
4210
|
const chainStatus = envelope === null || envelope === void 0 ? void 0 : envelope["Status"];
|
|
3883
|
-
|
|
4211
|
+
const refusal = chainErrorOf(body);
|
|
4212
|
+
const refusalStatus = refusal === null || refusal === void 0 ? void 0 : refusal["Status"];
|
|
4213
|
+
if (typeof refusalStatus === "number" && refusalStatus !== 1) throw new GalaSDKError("GATEWAY_WRITE_REJECTED", {
|
|
3884
4214
|
method,
|
|
3885
|
-
chainStatus,
|
|
3886
|
-
errorKey: stringField$1(
|
|
3887
|
-
serverMessage: stringField$1(
|
|
4215
|
+
chainStatus: refusalStatus,
|
|
4216
|
+
errorKey: stringField$1(refusal, "ErrorKey"),
|
|
4217
|
+
serverMessage: stringField$1(refusal, "Message")
|
|
3888
4218
|
}, context);
|
|
3889
4219
|
if (!response.ok) throw new GalaSDKError("GATEWAY_HTTP_ERROR", {
|
|
3890
4220
|
method,
|
|
@@ -3909,11 +4239,123 @@ function receiptOf(method, uniqueKey, url, response, body) {
|
|
|
3909
4239
|
*/
|
|
3910
4240
|
async function submitWrite(transport, method, dto, uniqueKey) {
|
|
3911
4241
|
const payload = await signedPayload(transport.signer, method, dto);
|
|
3912
|
-
const url = `${transport.gatewayBaseUrl}/api/${TOKEN_CONTRACT}/${method}`;
|
|
4242
|
+
const url = `${transport.gatewayBaseUrl}/api/${TOKEN_CONTRACT$1}/${method}`;
|
|
3913
4243
|
const { response, body } = await post(transport, method, url, payload, uniqueKey);
|
|
3914
4244
|
return receiptOf(method, uniqueKey, url, response, body);
|
|
3915
4245
|
}
|
|
3916
4246
|
|
|
4247
|
+
//#endregion
|
|
4248
|
+
//#region src/writes/nft_fee.ts
|
|
4249
|
+
/** The contract every NFT write, and the DryRun that prices it, is sent to. */
|
|
4250
|
+
const TOKEN_CONTRACT = "asset/token-contract";
|
|
4251
|
+
/** The key prefix of the chain's fee receipts: the channel's (`GCFR`) and the paying user's (`GCUR`). */
|
|
4252
|
+
const CHANNEL_RECEIPT = "\0GCFR\0";
|
|
4253
|
+
const USER_RECEIPT = "\0GCUR\0";
|
|
4254
|
+
function isRecord(value) {
|
|
4255
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4256
|
+
}
|
|
4257
|
+
function stringField(record, key) {
|
|
4258
|
+
const value = record[key];
|
|
4259
|
+
return typeof value === "string" ? value : "";
|
|
4260
|
+
}
|
|
4261
|
+
/**
|
|
4262
|
+
* Reads a simulated write's fee from its DryRun `Data`. The simulated write must have SUCCEEDED
|
|
4263
|
+
* (`response.Status` 1): a write the chain would refuse still writes its fee receipt in the
|
|
4264
|
+
* simulation, and quoting that as the price of a write that will not happen would be a lie, so a
|
|
4265
|
+
* refusal (`PAYMENT_REQUIRED`, `INSUFFICIENT_MINT_ALLOWANCE`, ...) is `GATEWAY_READ_REJECTED`.
|
|
4266
|
+
*
|
|
4267
|
+
* The fee is what the paying user's receipts (`GCUR`) add up to; the channel receipt (`GCFR`) the
|
|
4268
|
+
* chain writes beside each is the same payment seen from the channel, so it is counted only when
|
|
4269
|
+
* no user receipt exists. No receipt at all is a fee of `"0"`: the write is free.
|
|
4270
|
+
*
|
|
4271
|
+
* @throws GalaSDKError `GATEWAY_READ_REJECTED` (the simulated write failed), `GATEWAY_READ_RESPONSE_INVALID`
|
|
4272
|
+
* (an answer that is not a DryRun result, or a receipt with no readable quantity).
|
|
4273
|
+
*/
|
|
4274
|
+
function feeQuoteOf(method, data, context) {
|
|
4275
|
+
const invalid = () => new GalaSDKError("GATEWAY_READ_RESPONSE_INVALID", { method: "DryRun" }, {
|
|
4276
|
+
...context,
|
|
4277
|
+
body: data
|
|
4278
|
+
});
|
|
4279
|
+
if (!isRecord(data) || !isRecord(data["response"]) || !isRecord(data["writes"])) throw invalid();
|
|
4280
|
+
const response = data["response"];
|
|
4281
|
+
if (response["Status"] !== 1) throw new GalaSDKError("GATEWAY_READ_REJECTED", {
|
|
4282
|
+
method: "DryRun",
|
|
4283
|
+
chainStatus: typeof response["Status"] === "number" ? response["Status"] : 0,
|
|
4284
|
+
errorKey: stringField(response, "ErrorKey"),
|
|
4285
|
+
serverMessage: stringField(response, "Message")
|
|
4286
|
+
}, {
|
|
4287
|
+
...context,
|
|
4288
|
+
body: response
|
|
4289
|
+
});
|
|
4290
|
+
const user = [];
|
|
4291
|
+
const channel = [];
|
|
4292
|
+
for (const [key, value] of Object.entries(data["writes"])) {
|
|
4293
|
+
const target = key.startsWith(USER_RECEIPT) ? user : key.startsWith(CHANNEL_RECEIPT) ? channel : void 0;
|
|
4294
|
+
if (target === void 0) continue;
|
|
4295
|
+
let receipt;
|
|
4296
|
+
try {
|
|
4297
|
+
receipt = typeof value === "string" ? JSON.parse(value) : void 0;
|
|
4298
|
+
} catch {
|
|
4299
|
+
throw invalid();
|
|
4300
|
+
}
|
|
4301
|
+
const quantity = isRecord(receipt) ? receipt["quantity"] : void 0;
|
|
4302
|
+
const feeCode = isRecord(receipt) ? receipt["feeCode"] : void 0;
|
|
4303
|
+
if (typeof quantity !== "string" || typeof feeCode !== "string") throw invalid();
|
|
4304
|
+
const amount = new bignumber_js.default(quantity);
|
|
4305
|
+
if (!amount.isFinite() || amount.isNegative()) throw invalid();
|
|
4306
|
+
target.push({
|
|
4307
|
+
feeCode,
|
|
4308
|
+
quantity
|
|
4309
|
+
});
|
|
4310
|
+
}
|
|
4311
|
+
const receipts = user.length > 0 ? user : channel;
|
|
4312
|
+
return {
|
|
4313
|
+
method,
|
|
4314
|
+
fee: receipts.reduce((sum, receipt) => sum.plus(receipt.quantity), new bignumber_js.default(0)).toFixed(),
|
|
4315
|
+
feeToken: "GALA",
|
|
4316
|
+
receipts
|
|
4317
|
+
};
|
|
4318
|
+
}
|
|
4319
|
+
/**
|
|
4320
|
+
* Prices `dto` as `method` with the gateway's DryRun: a signed wrapper
|
|
4321
|
+
* `{ callerPublicKey, method, dto, uniqueKey }` (the inner DTO travels unsigned, as an object, with
|
|
4322
|
+
* no `dtoOperation`: a DryRun runs it inside the wrapper, which is what is signed for `DryRun`)
|
|
4323
|
+
* and nothing is written to the chain. A DryRun changes nothing, so every failure of it is a
|
|
4324
|
+
* READ's (`write: false`) and a retry is safe.
|
|
4325
|
+
*
|
|
4326
|
+
* @throws GalaSDKError the signer's pre-send `SIGNING_FAILED`; `REQUEST_TIMEOUT` / `TRANSPORT_ERROR`
|
|
4327
|
+
* (`write: false`); `GATEWAY_HTTP_ERROR`; `GATEWAY_READ_REJECTED`; `GATEWAY_READ_RESPONSE_INVALID`.
|
|
4328
|
+
*/
|
|
4329
|
+
async function quoteNftFee(transport, uniqueKeyPrefix, callerPublicKey, method, dto) {
|
|
4330
|
+
const payload = await signedPayload(transport.signer, "DryRun", {
|
|
4331
|
+
callerPublicKey,
|
|
4332
|
+
method,
|
|
4333
|
+
dto,
|
|
4334
|
+
uniqueKey: createUniqueKey(uniqueKeyPrefix)
|
|
4335
|
+
});
|
|
4336
|
+
const url = `${transport.gatewayBaseUrl}/api/${TOKEN_CONTRACT}/DryRun`;
|
|
4337
|
+
const response = await requestWithTimeout(transport.requestor, url, {
|
|
4338
|
+
method: "POST",
|
|
4339
|
+
headers: buildRequestHeaders(transport.wire, { json: true }),
|
|
4340
|
+
body: payload
|
|
4341
|
+
}, transport.timeoutMs, { write: false });
|
|
4342
|
+
let answer;
|
|
4343
|
+
try {
|
|
4344
|
+
answer = await readResponseBody(response);
|
|
4345
|
+
} catch (cause) {
|
|
4346
|
+
throw new GalaSDKError("TRANSPORT_ERROR", { url }, {
|
|
4347
|
+
url,
|
|
4348
|
+
cause,
|
|
4349
|
+
write: false
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4352
|
+
return feeQuoteOf(method, dataOf("DryRun", url, response, answer), {
|
|
4353
|
+
status: response.status,
|
|
4354
|
+
url,
|
|
4355
|
+
write: false
|
|
4356
|
+
});
|
|
4357
|
+
}
|
|
4358
|
+
|
|
3917
4359
|
//#endregion
|
|
3918
4360
|
//#region src/writes/token_ref.ts
|
|
3919
4361
|
/** A plain decimal: digits, optionally a fraction. No sign, exponent, hex, spaces or separators. */
|
|
@@ -4211,6 +4653,131 @@ var GatewayWrites = class {
|
|
|
4211
4653
|
const tokens = await this.resolveAll(checked);
|
|
4212
4654
|
return this.submit("UnlockToken", unlockTokenDto(this.walletAddress, tokens, uniqueKey, name), uniqueKey);
|
|
4213
4655
|
}
|
|
4656
|
+
/**
|
|
4657
|
+
* Claim an NFT collection name: authorize `authorizedUser` (default the writer) to create token
|
|
4658
|
+
* classes under it. The chain charges its claim fee (see {@link estimateNftFee}) and refuses a
|
|
4659
|
+
* name that is taken, whatever its casing.
|
|
4660
|
+
*
|
|
4661
|
+
* @throws GalaSDKError pre-send: `INVALID_NFT_INPUT`, `INVALID_WALLET_ADDRESS`,
|
|
4662
|
+
* `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight: `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check
|
|
4663
|
+
* `error.uniqueKey`; never resend under a fresh key); post-send: `GATEWAY_WRITE_REJECTED`,
|
|
4664
|
+
* `GATEWAY_HTTP_ERROR`, `GATEWAY_RESPONSE_INVALID` (also an answer for another collection).
|
|
4665
|
+
*/
|
|
4666
|
+
async claimNftCollection(input) {
|
|
4667
|
+
const prepared = this.prepareClaim(input);
|
|
4668
|
+
const receipt = await submitWrite(this.transport, "GrantNftCollectionAuthorization", prepared.dto, prepared.uniqueKey);
|
|
4669
|
+
return claimedCollection(receipt, prepared.collection);
|
|
4670
|
+
}
|
|
4671
|
+
/**
|
|
4672
|
+
* Create the token class of an NFT collection the writer is authorized for (`CreateNftCollection`).
|
|
4673
|
+
*
|
|
4674
|
+
* @throws GalaSDKError as {@link claimNftCollection}.
|
|
4675
|
+
*/
|
|
4676
|
+
async createNftCollection(input) {
|
|
4677
|
+
const prepared = this.prepareCreate(input);
|
|
4678
|
+
const receipt = await submitWrite(this.transport, "CreateNftCollection", prepared.dto, prepared.uniqueKey);
|
|
4679
|
+
return createdTokenClass(receipt, prepared.tokenClass);
|
|
4680
|
+
}
|
|
4681
|
+
/**
|
|
4682
|
+
* Mint 1 to 1000 NFTs of a token class the writer is a token authority of, to `owner` (default
|
|
4683
|
+
* the writer). The receipt lists the instances the chain created, as the chain answered them.
|
|
4684
|
+
*
|
|
4685
|
+
* @throws GalaSDKError as {@link claimNftCollection}.
|
|
4686
|
+
*/
|
|
4687
|
+
async mintNft(input) {
|
|
4688
|
+
const prepared = this.prepareMint(input);
|
|
4689
|
+
const receipt = await submitWrite(this.transport, prepared.method, prepared.dto, prepared.uniqueKey);
|
|
4690
|
+
return mintedInstances(receipt, prepared.tokenClass, prepared.quantity);
|
|
4691
|
+
}
|
|
4692
|
+
/**
|
|
4693
|
+
* What GalaChain's DryRun says an NFT write would cost, for the same input the write takes,
|
|
4694
|
+
* checked the same way, and with nothing written to the chain. The fee is the network's own
|
|
4695
|
+
* figure for this environment (it differs between stage and mainnet), never a constant.
|
|
4696
|
+
*
|
|
4697
|
+
* `callerPublicKey` is the writer's secp256k1 public key (hex): the chain's DryRun needs a caller
|
|
4698
|
+
* and a signer is not asked for its key. A write the chain would refuse (no authorization, no
|
|
4699
|
+
* balance, no mint allowance) is `GATEWAY_READ_REJECTED`, never a fee.
|
|
4700
|
+
*
|
|
4701
|
+
* @throws GalaSDKError the input checks of the write; `INVALID_NFT_INPUT` for a bad key;
|
|
4702
|
+
* `SIGNING_FAILED`; `REQUEST_TIMEOUT` / `TRANSPORT_ERROR` (`write: false`); `GATEWAY_HTTP_ERROR`;
|
|
4703
|
+
* `GATEWAY_READ_REJECTED`; `GATEWAY_READ_RESPONSE_INVALID`.
|
|
4704
|
+
*/
|
|
4705
|
+
async estimateNftFee(request, options) {
|
|
4706
|
+
const callerPublicKey = nftCallerPublicKey(options.callerPublicKey);
|
|
4707
|
+
const prepared = this.prepareFeeRequest(request);
|
|
4708
|
+
return await quoteNftFee(this.transport, this.uniqueKeyPrefix, callerPublicKey, prepared.method, prepared.dto);
|
|
4709
|
+
}
|
|
4710
|
+
prepareFeeRequest(request) {
|
|
4711
|
+
switch (request.write) {
|
|
4712
|
+
case "claimNftCollection": {
|
|
4713
|
+
const { dto } = this.prepareClaim(request);
|
|
4714
|
+
return {
|
|
4715
|
+
method: "GrantNftCollectionAuthorization",
|
|
4716
|
+
dto
|
|
4717
|
+
};
|
|
4718
|
+
}
|
|
4719
|
+
case "createNftCollection": {
|
|
4720
|
+
const { dto } = this.prepareCreate(request);
|
|
4721
|
+
return {
|
|
4722
|
+
method: "CreateNftCollection",
|
|
4723
|
+
dto
|
|
4724
|
+
};
|
|
4725
|
+
}
|
|
4726
|
+
case "mintNft": {
|
|
4727
|
+
const { method, dto } = this.prepareMint(request);
|
|
4728
|
+
return {
|
|
4729
|
+
method,
|
|
4730
|
+
dto
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
/** Everything a claim needs, every input checked before the key is spent. */
|
|
4736
|
+
prepareClaim(input) {
|
|
4737
|
+
const collection = nftClassPart(input.collection, "collection");
|
|
4738
|
+
const authorizedUser = input.authorizedUser === void 0 ? this.walletAddress : galaChainUserRef(input.authorizedUser, "authorizedUser");
|
|
4739
|
+
const uniqueKey = this.uniqueKeyOf(input.uniqueKey);
|
|
4740
|
+
return {
|
|
4741
|
+
collection,
|
|
4742
|
+
uniqueKey,
|
|
4743
|
+
dto: claimNftCollectionDto(collection, authorizedUser, uniqueKey)
|
|
4744
|
+
};
|
|
4745
|
+
}
|
|
4746
|
+
prepareCreate(input) {
|
|
4747
|
+
const tokenClass = nftTokenClass(input);
|
|
4748
|
+
const fields = {
|
|
4749
|
+
name: nftText(input.name, "name"),
|
|
4750
|
+
symbol: nftString(input.symbol, "symbol"),
|
|
4751
|
+
description: nftText(input.description, "description"),
|
|
4752
|
+
image: nftText(input.image, "image"),
|
|
4753
|
+
maxSupply: nftWholeNumber(input.maxSupply, "maxSupply"),
|
|
4754
|
+
maxCapacity: input.maxCapacity === void 0 ? void 0 : nftWholeNumber(input.maxCapacity, "maxCapacity"),
|
|
4755
|
+
metadataAddress: input.metadataAddress === void 0 ? void 0 : nftText(input.metadataAddress, "metadataAddress"),
|
|
4756
|
+
contractAddress: input.contractAddress === void 0 ? void 0 : nftText(input.contractAddress, "contractAddress"),
|
|
4757
|
+
rarity: input.rarity === void 0 ? void 0 : nftText(input.rarity, "rarity"),
|
|
4758
|
+
authorities: input.authorities === void 0 ? void 0 : nftAuthorities(input.authorities)
|
|
4759
|
+
};
|
|
4760
|
+
const uniqueKey = this.uniqueKeyOf(input.uniqueKey);
|
|
4761
|
+
return {
|
|
4762
|
+
tokenClass,
|
|
4763
|
+
uniqueKey,
|
|
4764
|
+
dto: createNftCollectionDto(tokenClass, fields, uniqueKey)
|
|
4765
|
+
};
|
|
4766
|
+
}
|
|
4767
|
+
prepareMint(input) {
|
|
4768
|
+
const tokenClass = nftTokenClass(input);
|
|
4769
|
+
const quantity = nftMintQuantity(input.quantity, "quantity");
|
|
4770
|
+
const owner = input.owner === void 0 ? this.walletAddress : galaChainUserRef(input.owner, "owner");
|
|
4771
|
+
const method = input.existingAllowance === true ? "MintToken" : "MintTokenWithAllowance";
|
|
4772
|
+
const uniqueKey = this.uniqueKeyOf(input.uniqueKey);
|
|
4773
|
+
return {
|
|
4774
|
+
method,
|
|
4775
|
+
tokenClass,
|
|
4776
|
+
quantity,
|
|
4777
|
+
uniqueKey,
|
|
4778
|
+
dto: mintNftDto(method, tokenClass, owner, quantity, uniqueKey)
|
|
4779
|
+
};
|
|
4780
|
+
}
|
|
4214
4781
|
/** The caller's key, checked, or a fresh one. */
|
|
4215
4782
|
uniqueKeyOf(given) {
|
|
4216
4783
|
if (given === void 0) return createUniqueKey(this.uniqueKeyPrefix);
|
|
@@ -4421,113 +4988,6 @@ function parsePage(value, parse) {
|
|
|
4421
4988
|
};
|
|
4422
4989
|
}
|
|
4423
4990
|
|
|
4424
|
-
//#endregion
|
|
4425
|
-
//#region src/reads/request.ts
|
|
4426
|
-
/** The chaincode contract each read method belongs to (part of its URL). */
|
|
4427
|
-
const CONTRACT_OF = {
|
|
4428
|
-
FetchBalances: "token-contract",
|
|
4429
|
-
FetchTokenClasses: "token-contract",
|
|
4430
|
-
FetchTokenClassesWithSupply: "token-contract",
|
|
4431
|
-
FetchTokenClassesWithPagination: "token-contract",
|
|
4432
|
-
FetchNftCollectionAuthorizationsWithPagination: "token-contract",
|
|
4433
|
-
GetPublicKey: "public-key-contract"
|
|
4434
|
-
};
|
|
4435
|
-
/**
|
|
4436
|
-
* Methods whose successful answer carries no `Status`: the connect-api GalaChain proxies answer
|
|
4437
|
-
* `GetPublicKey` with `{ Data: { publicKey } }` only (recorded 2026-10-14, prod and stage,
|
|
4438
|
-
* `tests/fixtures/public-key-recorded.json`). A `Status` they do send is still checked.
|
|
4439
|
-
*/
|
|
4440
|
-
const ANSWERED_WITHOUT_STATUS = /* @__PURE__ */ new Set(["GetPublicKey"]);
|
|
4441
|
-
/**
|
|
4442
|
-
* The channel of a collection: `$MUSIC` (and `MUSIC`, any case) lives on the gateway's `music`
|
|
4443
|
-
* channel, every other collection (`$GMUSIC` included) on `asset`.
|
|
4444
|
-
*/
|
|
4445
|
-
function channelOf(collection) {
|
|
4446
|
-
return collection !== void 0 && /^\$?music$/iu.test(collection) ? "music" : "asset";
|
|
4447
|
-
}
|
|
4448
|
-
function isRecord(value) {
|
|
4449
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4450
|
-
}
|
|
4451
|
-
function stringField(record, key) {
|
|
4452
|
-
const value = record === null || record === void 0 ? void 0 : record[key];
|
|
4453
|
-
return typeof value === "string" ? value : "";
|
|
4454
|
-
}
|
|
4455
|
-
/**
|
|
4456
|
-
* The chain's error object of a refused answer: GalaChain's gateway nests it as
|
|
4457
|
-
* `{ error: { Status: 0, ErrorKey, Message, ErrorPayload }, message }`; an older answer carries
|
|
4458
|
-
* `Status` / `ErrorKey` / `Message` at the top.
|
|
4459
|
-
*/
|
|
4460
|
-
function chainErrorOf(body) {
|
|
4461
|
-
if (!isRecord(body)) return void 0;
|
|
4462
|
-
const nested = body["error"];
|
|
4463
|
-
return isRecord(nested) ? nested : body;
|
|
4464
|
-
}
|
|
4465
|
-
/**
|
|
4466
|
-
* POSTs one read and returns the chain's `Data`. Reads change nothing, so every failure is a READ's
|
|
4467
|
-
* (`error.write === false`) and a retry is always safe:
|
|
4468
|
-
*
|
|
4469
|
-
* - no answer: `REQUEST_TIMEOUT` / `TRANSPORT_ERROR`, both `write: false` (an app requestor's
|
|
4470
|
-
* own rejection passes through unchanged: it is the app's error); a body that broke off is
|
|
4471
|
-
* `TRANSPORT_ERROR`;
|
|
4472
|
-
* - a numeric top-level `Status` other than 1, in any HTTP status: `GATEWAY_READ_REJECTED`;
|
|
4473
|
-
* - any other non-2xx: `GATEWAY_HTTP_ERROR` (`params.status`; the chain's refusal is `error.body`);
|
|
4474
|
-
* - a 2xx that is not `{ Status: 1, Data }` (for `GetPublicKey`, whose answer carries no
|
|
4475
|
-
* `Status`, not `{ Data }`): `GATEWAY_READ_RESPONSE_INVALID`.
|
|
4476
|
-
*/
|
|
4477
|
-
async function readGateway(transport, method, body, channel = "asset") {
|
|
4478
|
-
const url = `${transport.gatewayBaseUrl}/api/${channel}/${CONTRACT_OF[method]}/${method}`;
|
|
4479
|
-
const response = await requestWithTimeout(transport.requestor, url, {
|
|
4480
|
-
method: "POST",
|
|
4481
|
-
headers: buildRequestHeaders(transport.wire, { json: true }),
|
|
4482
|
-
body: JSON.stringify(body)
|
|
4483
|
-
}, transport.timeoutMs, { write: false });
|
|
4484
|
-
let answer;
|
|
4485
|
-
try {
|
|
4486
|
-
answer = await readResponseBody(response);
|
|
4487
|
-
} catch (cause) {
|
|
4488
|
-
throw new GalaSDKError("TRANSPORT_ERROR", { url }, {
|
|
4489
|
-
url,
|
|
4490
|
-
cause,
|
|
4491
|
-
write: false
|
|
4492
|
-
});
|
|
4493
|
-
}
|
|
4494
|
-
return dataOf(method, url, response, answer);
|
|
4495
|
-
}
|
|
4496
|
-
function dataOf(method, url, response, answer) {
|
|
4497
|
-
const context = {
|
|
4498
|
-
status: response.status,
|
|
4499
|
-
body: answer,
|
|
4500
|
-
url,
|
|
4501
|
-
write: false
|
|
4502
|
-
};
|
|
4503
|
-
const envelope = isRecord(answer) ? answer : void 0;
|
|
4504
|
-
const chainStatus = envelope === null || envelope === void 0 ? void 0 : envelope["Status"];
|
|
4505
|
-
if (typeof chainStatus === "number" && chainStatus !== 1) throw new GalaSDKError("GATEWAY_READ_REJECTED", {
|
|
4506
|
-
method,
|
|
4507
|
-
chainStatus,
|
|
4508
|
-
errorKey: stringField(envelope, "ErrorKey"),
|
|
4509
|
-
serverMessage: stringField(envelope, "Message")
|
|
4510
|
-
}, context);
|
|
4511
|
-
if (!response.ok) {
|
|
4512
|
-
const chainError = chainErrorOf(answer);
|
|
4513
|
-
throw new GalaSDKError("GATEWAY_HTTP_ERROR", {
|
|
4514
|
-
method,
|
|
4515
|
-
status: response.status,
|
|
4516
|
-
serverMessage: stringField(chainError, "Message") || stringField(envelope, "message")
|
|
4517
|
-
}, context);
|
|
4518
|
-
}
|
|
4519
|
-
const statusAccepted = chainStatus === 1 || chainStatus === void 0 && ANSWERED_WITHOUT_STATUS.has(method);
|
|
4520
|
-
if (envelope === void 0 || !statusAccepted || !("Data" in envelope)) throw new GalaSDKError("GATEWAY_READ_RESPONSE_INVALID", { method }, context);
|
|
4521
|
-
return envelope["Data"];
|
|
4522
|
-
}
|
|
4523
|
-
/** The error for a 2xx whose `Data` is not what `method` answers. */
|
|
4524
|
-
function invalidAnswer(method, data) {
|
|
4525
|
-
return new GalaSDKError("GATEWAY_READ_RESPONSE_INVALID", { method }, {
|
|
4526
|
-
body: data,
|
|
4527
|
-
write: false
|
|
4528
|
-
});
|
|
4529
|
-
}
|
|
4530
|
-
|
|
4531
4991
|
//#endregion
|
|
4532
4992
|
//#region src/reads/types.ts
|
|
4533
4993
|
/**
|
|
@@ -4906,6 +5366,120 @@ function notFoundOf(error) {
|
|
|
4906
5366
|
});
|
|
4907
5367
|
}
|
|
4908
5368
|
|
|
5369
|
+
//#endregion
|
|
5370
|
+
//#region src/reads/nft_collections.ts
|
|
5371
|
+
/** A read's collection name: 3 to 50 letters and digits. @throws GalaSDKError `INVALID_NFT_INPUT`. */
|
|
5372
|
+
function collectionName(name, field) {
|
|
5373
|
+
if (typeof name !== "string") throw new GalaSDKError("INVALID_NFT_INPUT", {
|
|
5374
|
+
field,
|
|
5375
|
+
reason: "not_a_string"
|
|
5376
|
+
});
|
|
5377
|
+
if (name === "") throw new GalaSDKError("INVALID_NFT_INPUT", {
|
|
5378
|
+
field,
|
|
5379
|
+
reason: "empty"
|
|
5380
|
+
});
|
|
5381
|
+
if (!/^[a-zA-Z0-9]{3,50}$/u.test(name)) throw new GalaSDKError("INVALID_NFT_INPUT", {
|
|
5382
|
+
field,
|
|
5383
|
+
reason: "bad_collection_name"
|
|
5384
|
+
});
|
|
5385
|
+
return name;
|
|
5386
|
+
}
|
|
5387
|
+
function validAddress(value) {
|
|
5388
|
+
try {
|
|
5389
|
+
galaChainUserRef(value, "address");
|
|
5390
|
+
return true;
|
|
5391
|
+
} catch {
|
|
5392
|
+
return false;
|
|
5393
|
+
}
|
|
5394
|
+
}
|
|
5395
|
+
function canonicalAddress(value) {
|
|
5396
|
+
return (validAddress(value) ? galaChainUserRef(value, "address") : value).toLowerCase();
|
|
5397
|
+
}
|
|
5398
|
+
/** NFT collection reads in Launchpad result shapes, using a shared gateway reader. */
|
|
5399
|
+
var NftCollectionReads = class {
|
|
5400
|
+
reads;
|
|
5401
|
+
constructor(reads) {
|
|
5402
|
+
this.reads = reads;
|
|
5403
|
+
}
|
|
5404
|
+
async fetchNftCollections(walletAddress) {
|
|
5405
|
+
const authorizedUser = galaChainUserRef(walletAddress, "walletAddress");
|
|
5406
|
+
return (await this.reads.fetchAllNftCollectionAuthorizations({ pageSize: 1e3 })).filter((row) => row.authorizedUsers.some((user) => canonicalAddress(user) === canonicalAddress(authorizedUser))).map((row) => ({
|
|
5407
|
+
authorizedUser,
|
|
5408
|
+
collection: row.collection
|
|
5409
|
+
}));
|
|
5410
|
+
}
|
|
5411
|
+
async isNftCollectionAvailable(name) {
|
|
5412
|
+
const collection = collectionName(name, "collection");
|
|
5413
|
+
return !(await this.reads.fetchAllNftCollectionAuthorizations({ pageSize: 1e3 })).some((row) => row.collection === collection);
|
|
5414
|
+
}
|
|
5415
|
+
async fetchNftTokenClasses(params) {
|
|
5416
|
+
collectionName(params.collection, "collection");
|
|
5417
|
+
return (await this.reads.fetchAllTokenClasses({
|
|
5418
|
+
collection: params.collection,
|
|
5419
|
+
category: params.category,
|
|
5420
|
+
type: params.type
|
|
5421
|
+
}, { pageSize: 1e3 })).map((row) => ({
|
|
5422
|
+
collection: row.collection,
|
|
5423
|
+
type: row.type,
|
|
5424
|
+
category: row.category,
|
|
5425
|
+
additionalKey: row.additionalKey,
|
|
5426
|
+
totalSupply: row.totalSupply,
|
|
5427
|
+
maxSupply: row.maxSupply,
|
|
5428
|
+
isNonFungible: row.isNonFungible,
|
|
5429
|
+
name: row.name,
|
|
5430
|
+
description: row.description,
|
|
5431
|
+
image: row.image,
|
|
5432
|
+
symbol: row.symbol,
|
|
5433
|
+
...row.rarity === void 0 ? {} : { rarity: row.rarity }
|
|
5434
|
+
}));
|
|
5435
|
+
}
|
|
5436
|
+
async fetchNftBalances(ownerAddress, collectionFilter) {
|
|
5437
|
+
const owner = galaChainUserRef(ownerAddress, "ownerAddress");
|
|
5438
|
+
return (await this.reads.fetchNftBalances({
|
|
5439
|
+
owner,
|
|
5440
|
+
collection: collectionFilter
|
|
5441
|
+
})).map((row) => ({
|
|
5442
|
+
owner: row.owner,
|
|
5443
|
+
collection: row.collection,
|
|
5444
|
+
category: row.category,
|
|
5445
|
+
type: row.type,
|
|
5446
|
+
additionalKey: row.additionalKey,
|
|
5447
|
+
instanceIds: [...row.instanceIds],
|
|
5448
|
+
totalOwned: row.instanceIds.length
|
|
5449
|
+
}));
|
|
5450
|
+
}
|
|
5451
|
+
};
|
|
5452
|
+
|
|
5453
|
+
//#endregion
|
|
5454
|
+
//#region src/reads/nft_fees.ts
|
|
5455
|
+
function getNftCollectionClaimFee() {
|
|
5456
|
+
return "10000";
|
|
5457
|
+
}
|
|
5458
|
+
function getNftTokenClassCreateFee() {
|
|
5459
|
+
return "1000";
|
|
5460
|
+
}
|
|
5461
|
+
/** Calculate the fixed fees for the requested collection and token-class operations. */
|
|
5462
|
+
function estimateNftOperationFees(params) {
|
|
5463
|
+
let totalFee = "0";
|
|
5464
|
+
const breakdown = {};
|
|
5465
|
+
if (params.claimCollection) {
|
|
5466
|
+
const fee = getNftCollectionClaimFee();
|
|
5467
|
+
breakdown.collectionClaim = fee;
|
|
5468
|
+
totalFee = String(BigInt(totalFee) + BigInt(fee));
|
|
5469
|
+
}
|
|
5470
|
+
if ((params.createTokenClasses ?? 0) > 0) {
|
|
5471
|
+
const count = params.createTokenClasses;
|
|
5472
|
+
const fee = getNftTokenClassCreateFee();
|
|
5473
|
+
breakdown.tokenClassCreate = fee;
|
|
5474
|
+
breakdown.tokenClassCount = count;
|
|
5475
|
+
totalFee = String(BigInt(totalFee) + BigInt(fee) * BigInt(count));
|
|
5476
|
+
}
|
|
5477
|
+
return {
|
|
5478
|
+
totalFee,
|
|
5479
|
+
breakdown
|
|
5480
|
+
};
|
|
5481
|
+
}
|
|
5482
|
+
|
|
4909
5483
|
//#endregion
|
|
4910
5484
|
//#region src/config/environments.ts
|
|
4911
5485
|
/**
|
|
@@ -4953,8 +5527,13 @@ exports.GalaSDKError = GalaSDKError;
|
|
|
4953
5527
|
exports.GalaWalletSigner = GalaWalletSigner;
|
|
4954
5528
|
exports.GatewayReads = GatewayReads;
|
|
4955
5529
|
exports.GatewayWrites = GatewayWrites;
|
|
5530
|
+
exports.INVALID_NFT_INPUT_REASONS = INVALID_NFT_INPUT_REASONS;
|
|
4956
5531
|
exports.INVALID_PRIVATE_KEY_REASONS = INVALID_PRIVATE_KEY_REASONS;
|
|
4957
5532
|
exports.INVALID_TOKEN_REFERENCE_REASONS = INVALID_TOKEN_REFERENCE_REASONS;
|
|
5533
|
+
exports.NFT_DEFAULT_ADDITIONAL_KEY = NFT_DEFAULT_ADDITIONAL_KEY;
|
|
5534
|
+
exports.NFT_MINT_LIMIT = NFT_MINT_LIMIT;
|
|
5535
|
+
exports.NFT_WRITE_METHODS = NFT_WRITE_METHODS;
|
|
5536
|
+
exports.NftCollectionReads = NftCollectionReads;
|
|
4958
5537
|
exports.PAGE_REQUEST_FIELDS = PAGE_REQUEST_FIELDS;
|
|
4959
5538
|
exports.PrivateKeySigner = PrivateKeySigner;
|
|
4960
5539
|
exports.SIGNING_FAILURE_REASONS = SIGNING_FAILURE_REASONS;
|
|
@@ -4979,6 +5558,7 @@ exports.createWallet = createWallet;
|
|
|
4979
5558
|
exports.dtoOperationOf = dtoOperationOf;
|
|
4980
5559
|
exports.eip1193ProviderFromEthers = eip1193ProviderFromEthers;
|
|
4981
5560
|
exports.eip712DomainFor = eip712DomainFor;
|
|
5561
|
+
exports.estimateNftOperationFees = estimateNftOperationFees;
|
|
4982
5562
|
exports.ethAddressOfPrivateKey = ethAddressOfPrivateKey;
|
|
4983
5563
|
exports.ethereumAddressOfAccount = ethereumAddressOfAccount;
|
|
4984
5564
|
exports.fetchRequestor = fetchRequestor;
|
|
@@ -4987,6 +5567,8 @@ exports.galaChainUserRef = galaChainUserRef;
|
|
|
4987
5567
|
exports.galaErrorTemplates = galaErrorTemplates;
|
|
4988
5568
|
exports.generateEIP712Types = generateEIP712Types;
|
|
4989
5569
|
exports.getEthereumAddressFromPrivateKey = getEthereumAddressFromPrivateKey;
|
|
5570
|
+
exports.getNftCollectionClaimFee = getNftCollectionClaimFee;
|
|
5571
|
+
exports.getNftTokenClassCreateFee = getNftTokenClassCreateFee;
|
|
4990
5572
|
exports.getPayloadToSign = getPayloadToSign;
|
|
4991
5573
|
exports.getPublicKeyFromPrivateKey = getPublicKeyFromPrivateKey;
|
|
4992
5574
|
exports.hasGalaErrorBrand = hasGalaErrorBrand;
|