@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/dist/index.d.cts CHANGED
@@ -89,6 +89,13 @@ type SigningFailureReason = (typeof SIGNING_FAILURE_REASONS)[number];
89
89
  export declare const INVALID_TOKEN_REFERENCE_REASONS: readonly ['missing', 'ambiguous', 'bad_class_key', 'bad_instance'];
90
90
  /** One member of {@link INVALID_TOKEN_REFERENCE_REASONS}. */
91
91
  type InvalidTokenReferenceReason = (typeof INVALID_TOKEN_REFERENCE_REASONS)[number];
92
+ /**
93
+ * Why an NFT read's, write's or fee quote's input is refused (`INVALID_NFT_INPUT.params.reason`).
94
+ * A token for the app to map to its own text.
95
+ */
96
+ export declare const INVALID_NFT_INPUT_REASONS: readonly ['not_a_string', 'empty', 'bad_characters', 'not_a_positive_whole_number', 'above_mint_limit', 'bad_public_key', 'bad_authorities', 'bad_collection_name'];
97
+ /** One member of {@link INVALID_NFT_INPUT_REASONS}. */
98
+ type InvalidNftInputReason = (typeof INVALID_NFT_INPUT_REASONS)[number];
92
99
  /**
93
100
  * The `GatewayWrites` options that are refused when missing or of the wrong type
94
101
  * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and
@@ -621,6 +628,14 @@ export declare const GALA_ERROR_CATALOG: {
621
628
  readonly valueType: 'string';
622
629
  };
623
630
  };
631
+ readonly INVALID_NFT_INPUT: {
632
+ readonly phase: 'pre_send';
633
+ readonly template: 'Invalid NFT input {field}: {reason}.';
634
+ readonly params: {
635
+ readonly field: 'string';
636
+ readonly reason: readonly ["not_a_string", "empty", "bad_characters", "not_a_positive_whole_number", "above_mint_limit", "bad_public_key", "bad_authorities", "bad_collection_name"];
637
+ };
638
+ };
624
639
  readonly NO_TOKEN_NAME_RESOLVER: {
625
640
  readonly phase: 'pre_send';
626
641
  readonly template: 'The token name "{tokenName}" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.';
@@ -1008,6 +1023,7 @@ export declare const GALA_ERROR_PHASE_BY_CODE: {
1008
1023
  readonly INVALID_TOKEN_BATCH: 'pre_send';
1009
1024
  readonly INVALID_LOCK_EXPIRES: 'pre_send';
1010
1025
  readonly INVALID_LOCK_NAME: 'pre_send';
1026
+ readonly INVALID_NFT_INPUT: 'pre_send';
1011
1027
  readonly NO_TOKEN_NAME_RESOLVER: 'pre_send';
1012
1028
  readonly TOKEN_NAME_RESOLUTION_FAILED: 'pre_send';
1013
1029
  readonly GATEWAY_WRITE_OUTCOME_UNKNOWN: 'in_flight';
@@ -2649,9 +2665,9 @@ interface GatewayWritesOptions {
2649
2665
  /**
2650
2666
  * What a gateway write returns once GalaChain accepted it (`Status: 1`).
2651
2667
  */
2652
- interface GatewayWriteReceipt {
2668
+ interface WriteReceipt<M extends string> {
2653
2669
  /** The method that was submitted. */
2654
- readonly method: GatewayWriteMethod;
2670
+ readonly method: M;
2655
2671
  /** The `uniqueKey` that was signed (the minted one when the caller gave none). */
2656
2672
  readonly uniqueKey: string;
2657
2673
  /**
@@ -2667,8 +2683,134 @@ interface GatewayWriteReceipt {
2667
2683
  /** The whole parsed answer. */
2668
2684
  readonly body: unknown;
2669
2685
  }
2686
+ /** What a token write (transfer, burn, lock, unlock) returns once GalaChain accepted it. */
2687
+ type GatewayWriteReceipt = WriteReceipt<GatewayWriteMethod>;
2688
+ //#endregion
2689
+ //#region src/writes/nft.d.ts
2690
+ /**
2691
+ * The NFT methods of GalaChain's token contract that `GatewayWrites` signs and submits, as a closed
2692
+ * set: claim a collection name (`GrantNftCollectionAuthorization`), create the NFT collection's
2693
+ * token class (`CreateNftCollection`), mint NFTs, granting the minter its own mint allowance in
2694
+ * the same transaction (`MintTokenWithAllowance`) or against an allowance it already holds
2695
+ * (`MintToken`).
2696
+ */
2697
+ export declare const NFT_WRITE_METHODS: readonly ['GrantNftCollectionAuthorization', 'CreateNftCollection', 'MintTokenWithAllowance', 'MintToken'];
2698
+ /** One member of {@link NFT_WRITE_METHODS}. */
2699
+ type NftWriteMethod = (typeof NFT_WRITE_METHODS)[number];
2700
+ /** The most NFTs one mint may create (the chain's `MintTokenDto.MAX_NFT_MINT_SIZE`). */
2701
+ export declare const NFT_MINT_LIMIT = 1000;
2702
+ /** The `additionalKey` an NFT token class carries when its creator names none (GalaChain's `none`). */
2703
+ export declare const NFT_DEFAULT_ADDITIONAL_KEY = "none";
2704
+ /** The four parts of the NFT token class a write names; `additionalKey` defaults to `none`. */
2705
+ interface NftTokenClassInput {
2706
+ /** The NFT collection name (the one claimed with `claimNftCollection`). */
2707
+ collection: string;
2708
+ /** The category of the token class. */
2709
+ category: string;
2710
+ /** The type of the token class. */
2711
+ type: string;
2712
+ /** The additional key of the token class; default `none`. */
2713
+ additionalKey?: string | undefined;
2714
+ }
2715
+ /** `claimNftCollection`: authorize a user to create token classes under a collection name. */
2716
+ interface ClaimNftCollectionInput extends WriteKeyInput {
2717
+ /** The collection name to claim. The chain refuses a name that is taken (case-insensitively). */
2718
+ collection: string;
2719
+ /**
2720
+ * Who is authorized to create the collection: a user reference in any of the forms of
2721
+ * `TransferGalaInput.to`; default the writer. The chain stores the authorization under the
2722
+ * account the reference names (an `eth|` reference becomes that account's `client|` alias).
2723
+ */
2724
+ authorizedUser?: string | undefined;
2725
+ }
2726
+ /** `createNftCollection`: create the token class of an NFT collection the writer is authorized for. */
2727
+ interface CreateNftCollectionInput extends NftTokenClassInput, WriteKeyInput {
2728
+ /** The token class's name. */
2729
+ name: string;
2730
+ /** The token class's symbol (a string; it may be empty). */
2731
+ symbol: string;
2732
+ /** The token class's description. */
2733
+ description: string;
2734
+ /** The token class's image URL. */
2735
+ image: string;
2736
+ /**
2737
+ * The most NFTs that may ever exist, a positive whole number as a decimal string. Required: the
2738
+ * chain refuses an NFT class whose supply is unbounded ("maxSupply must be finite").
2739
+ */
2740
+ maxSupply: string;
2741
+ /** The most NFTs that may be held at once, a positive whole number as a decimal string. */
2742
+ maxCapacity?: string | undefined;
2743
+ /** An optional metadata address. */
2744
+ metadataAddress?: string | undefined;
2745
+ /** An optional contract address. */
2746
+ contractAddress?: string | undefined;
2747
+ /** An optional rarity label. */
2748
+ rarity?: string | undefined;
2749
+ /**
2750
+ * The token authorities, as user references. Default (when omitted): the writer. They are the
2751
+ * accounts that may mint; naming others without the writer makes the writer unable to mint.
2752
+ */
2753
+ authorities?: readonly string[] | undefined;
2754
+ }
2755
+ /** `mintNft`: mint NFTs of a token class the writer is a token authority of. */
2756
+ interface MintNftInput extends NftTokenClassInput, WriteKeyInput {
2757
+ /** How many NFTs to mint, a whole number from 1 to {@link NFT_MINT_LIMIT} as a decimal string. */
2758
+ quantity: string;
2759
+ /** Who receives them: a user reference; default the writer. */
2760
+ owner?: string | undefined;
2761
+ /**
2762
+ * `false` (default): `MintTokenWithAllowance`, which grants the writer its own mint allowance in
2763
+ * the same transaction. `true`: `MintToken`, which spends a mint allowance the writer already
2764
+ * holds and is refused (`INSUFFICIENT_MINT_ALLOWANCE`) without one.
2765
+ */
2766
+ existingAllowance?: boolean | undefined;
2767
+ }
2768
+ /** What a claim returned: the collection and every account now authorized for it. */
2769
+ type ClaimNftCollectionReceipt = WriteReceipt<'GrantNftCollectionAuthorization'> & {
2770
+ readonly collection: string;
2771
+ readonly authorizedUsers: readonly string[];
2772
+ };
2773
+ /** What a create returned: the token class it created. */
2774
+ type CreateNftCollectionReceipt = WriteReceipt<'CreateNftCollection'> & {
2775
+ readonly tokenClass: Readonly<GalaChainTokenClassKey>;
2776
+ };
2777
+ /** What a mint returned: the NFT instances it created, in the chain's order. */
2778
+ type MintNftReceipt = WriteReceipt<'MintTokenWithAllowance' | 'MintToken'> & {
2779
+ readonly tokenInstances: readonly GalaChainTokenInstanceKey[];
2780
+ };
2781
+ //#endregion
2782
+ //#region src/writes/nft_fee.d.ts
2783
+ /** One fee the simulated write would pay. */
2784
+ interface NftFeeReceipt {
2785
+ /** The chain's fee code (`NftCollectionAuthorization`, `CreateNftCollection`, ...). */
2786
+ readonly feeCode: string;
2787
+ /** The fee in whole GALA, a decimal string. */
2788
+ readonly quantity: string;
2789
+ }
2790
+ /** What GalaChain's DryRun says a write would cost. */
2791
+ interface NftFeeQuote {
2792
+ /** The method that was simulated. */
2793
+ readonly method: NftWriteMethod;
2794
+ /** The network fee in GALA, a decimal string; `"0"` only when the chain wrote no fee receipt. */
2795
+ readonly fee: string;
2796
+ /** The fee token: always GALA. */
2797
+ readonly feeToken: 'GALA';
2798
+ /** The fees the fee is the sum of, as the chain simulated them. */
2799
+ readonly receipts: readonly NftFeeReceipt[];
2800
+ }
2670
2801
  //#endregion
2671
2802
  //#region src/writes/gateway_writes.d.ts
2803
+ /**
2804
+ * What `estimateNftFee` prices: the input of one NFT write, named by the write's method. It takes the
2805
+ * same checks as the write.
2806
+ */
2807
+ type NftFeeRequest = ({
2808
+ write: 'claimNftCollection';
2809
+ } & ClaimNftCollectionInput) | ({
2810
+ write: 'createNftCollection';
2811
+ } & CreateNftCollectionInput) | ({
2812
+ write: 'mintNft';
2813
+ } & MintNftInput);
2672
2814
  /**
2673
2815
  * Signed GalaChain token-contract writes through the gateway: transfer GALA, transfer a token,
2674
2816
  * burn, lock and unlock. React Native safe (no Node builtins, no ethers, no `@gala-chain/api`).
@@ -2735,6 +2877,51 @@ export declare class GatewayWrites {
2735
2877
  * @throws GalaSDKError as {@link burnTokens}, plus `INVALID_LOCK_NAME`.
2736
2878
  */
2737
2879
  unlockTokens(input: UnlockTokensInput): Promise<GatewayWriteReceipt>;
2880
+ /**
2881
+ * Claim an NFT collection name: authorize `authorizedUser` (default the writer) to create token
2882
+ * classes under it. The chain charges its claim fee (see {@link estimateNftFee}) and refuses a
2883
+ * name that is taken, whatever its casing.
2884
+ *
2885
+ * @throws GalaSDKError pre-send: `INVALID_NFT_INPUT`, `INVALID_WALLET_ADDRESS`,
2886
+ * `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight: `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check
2887
+ * `error.uniqueKey`; never resend under a fresh key); post-send: `GATEWAY_WRITE_REJECTED`,
2888
+ * `GATEWAY_HTTP_ERROR`, `GATEWAY_RESPONSE_INVALID` (also an answer for another collection).
2889
+ */
2890
+ claimNftCollection(input: ClaimNftCollectionInput): Promise<ClaimNftCollectionReceipt>;
2891
+ /**
2892
+ * Create the token class of an NFT collection the writer is authorized for (`CreateNftCollection`).
2893
+ *
2894
+ * @throws GalaSDKError as {@link claimNftCollection}.
2895
+ */
2896
+ createNftCollection(input: CreateNftCollectionInput): Promise<CreateNftCollectionReceipt>;
2897
+ /**
2898
+ * Mint 1 to 1000 NFTs of a token class the writer is a token authority of, to `owner` (default
2899
+ * the writer). The receipt lists the instances the chain created, as the chain answered them.
2900
+ *
2901
+ * @throws GalaSDKError as {@link claimNftCollection}.
2902
+ */
2903
+ mintNft(input: MintNftInput): Promise<MintNftReceipt>;
2904
+ /**
2905
+ * What GalaChain's DryRun says an NFT write would cost, for the same input the write takes,
2906
+ * checked the same way, and with nothing written to the chain. The fee is the network's own
2907
+ * figure for this environment (it differs between stage and mainnet), never a constant.
2908
+ *
2909
+ * `callerPublicKey` is the writer's secp256k1 public key (hex): the chain's DryRun needs a caller
2910
+ * and a signer is not asked for its key. A write the chain would refuse (no authorization, no
2911
+ * balance, no mint allowance) is `GATEWAY_READ_REJECTED`, never a fee.
2912
+ *
2913
+ * @throws GalaSDKError the input checks of the write; `INVALID_NFT_INPUT` for a bad key;
2914
+ * `SIGNING_FAILED`; `REQUEST_TIMEOUT` / `TRANSPORT_ERROR` (`write: false`); `GATEWAY_HTTP_ERROR`;
2915
+ * `GATEWAY_READ_REJECTED`; `GATEWAY_READ_RESPONSE_INVALID`.
2916
+ */
2917
+ estimateNftFee(request: NftFeeRequest, options: {
2918
+ readonly callerPublicKey: string;
2919
+ }): Promise<NftFeeQuote>;
2920
+ private prepareFeeRequest;
2921
+ /** Everything a claim needs, every input checked before the key is spent. */
2922
+ private prepareClaim;
2923
+ private prepareCreate;
2924
+ private prepareMint;
2738
2925
  /** The caller's key, checked, or a fresh one. */
2739
2926
  private uniqueKeyOf;
2740
2927
  /** Every token and quantity of a batch write, checked synchronously, in order. */
@@ -3114,6 +3301,71 @@ export declare class GatewayReads {
3114
3301
  private readAllPages;
3115
3302
  }
3116
3303
  //#endregion
3304
+ //#region src/reads/nft_collections.d.ts
3305
+ interface NftCollectionAuthorization {
3306
+ authorizedUser: string;
3307
+ collection: string;
3308
+ created?: number;
3309
+ }
3310
+ interface FetchNftTokenClassesParams {
3311
+ collection: string;
3312
+ type?: string;
3313
+ category?: string;
3314
+ }
3315
+ interface NftTokenClassWithSupply {
3316
+ collection: string;
3317
+ type: string;
3318
+ category: string;
3319
+ additionalKey: string;
3320
+ totalSupply: string;
3321
+ maxSupply?: string;
3322
+ isNonFungible: boolean;
3323
+ name?: string;
3324
+ description?: string;
3325
+ image?: string;
3326
+ symbol?: string;
3327
+ rarity?: string;
3328
+ }
3329
+ interface NftBalance {
3330
+ owner: string;
3331
+ collection: string;
3332
+ category: string;
3333
+ type: string;
3334
+ additionalKey: string;
3335
+ instanceIds: string[];
3336
+ totalOwned: number;
3337
+ }
3338
+ /** NFT collection reads in Launchpad result shapes, using a shared gateway reader. */
3339
+ export declare class NftCollectionReads {
3340
+ private readonly reads;
3341
+ constructor(reads: GatewayReads);
3342
+ fetchNftCollections(walletAddress: string): Promise<NftCollectionAuthorization[]>;
3343
+ isNftCollectionAvailable(name: string): Promise<boolean>;
3344
+ fetchNftTokenClasses(params: FetchNftTokenClassesParams): Promise<NftTokenClassWithSupply[]>;
3345
+ fetchNftBalances(ownerAddress: string, collectionFilter?: string): Promise<NftBalance[]>;
3346
+ }
3347
+ //#endregion
3348
+ //#region src/reads/nft_fees.d.ts
3349
+ /** Fixed GalaChain NFT operation fees, denominated in GALA. */
3350
+ interface EstimateNftFeesParams {
3351
+ claimCollection?: boolean;
3352
+ createTokenClasses?: number;
3353
+ }
3354
+ interface NftFeeBreakdown {
3355
+ collectionClaim?: string;
3356
+ tokenClassCreate?: string;
3357
+ tokenClassCount?: number;
3358
+ mintFee?: string;
3359
+ }
3360
+ interface NftFeeEstimate {
3361
+ totalFee: string;
3362
+ breakdown: NftFeeBreakdown;
3363
+ }
3364
+ export declare function getNftCollectionClaimFee(): string;
3365
+ export declare function getNftTokenClassCreateFee(): string;
3366
+ /** Calculate the fixed fees for the requested collection and token-class operations. */
3367
+ export declare function estimateNftOperationFees(params: EstimateNftFeesParams): NftFeeEstimate;
3368
+ //#endregion
3117
3369
  //#region src/config/environments.d.ts
3118
3370
  /** A GalaChain deployment: `prod` (mainnet) or `stage` (testnet). */
3119
3371
  type GalaChainEnv = 'prod' | 'stage';
@@ -3203,5 +3455,5 @@ export declare function walletDeclineCode(value: unknown): number | string | und
3203
3455
  */
3204
3456
  export declare const GALA_CORE_SDK_VERSION: string;
3205
3457
  //#endregion
3206
- export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, EIP712DomainValue, EIP712Types, ErrorParamsOf, FailureOutcome, FailureView, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput };
3458
+ export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, ClaimNftCollectionInput, ClaimNftCollectionReceipt, CreateNftCollectionInput, CreateNftCollectionReceipt, EIP712DomainValue, EIP712Types, ErrorParamsOf, EstimateNftFeesParams, FailureOutcome, FailureView, FetchNftTokenClassesParams, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidNftInputReason, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, MintNftInput, MintNftReceipt, NftBalance, NftCollectionAuthorization, NftFeeBreakdown, NftFeeEstimate, NftFeeQuote, NftFeeReceipt, NftFeeRequest, NftTokenClassInput, NftTokenClassWithSupply, NftWriteMethod, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput, WriteReceipt };
3207
3459
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -89,6 +89,13 @@ type SigningFailureReason = (typeof SIGNING_FAILURE_REASONS)[number];
89
89
  export declare const INVALID_TOKEN_REFERENCE_REASONS: readonly ['missing', 'ambiguous', 'bad_class_key', 'bad_instance'];
90
90
  /** One member of {@link INVALID_TOKEN_REFERENCE_REASONS}. */
91
91
  type InvalidTokenReferenceReason = (typeof INVALID_TOKEN_REFERENCE_REASONS)[number];
92
+ /**
93
+ * Why an NFT read's, write's or fee quote's input is refused (`INVALID_NFT_INPUT.params.reason`).
94
+ * A token for the app to map to its own text.
95
+ */
96
+ export declare const INVALID_NFT_INPUT_REASONS: readonly ['not_a_string', 'empty', 'bad_characters', 'not_a_positive_whole_number', 'above_mint_limit', 'bad_public_key', 'bad_authorities', 'bad_collection_name'];
97
+ /** One member of {@link INVALID_NFT_INPUT_REASONS}. */
98
+ type InvalidNftInputReason = (typeof INVALID_NFT_INPUT_REASONS)[number];
92
99
  /**
93
100
  * The `GatewayWrites` options that are refused when missing or of the wrong type
94
101
  * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and
@@ -621,6 +628,14 @@ export declare const GALA_ERROR_CATALOG: {
621
628
  readonly valueType: 'string';
622
629
  };
623
630
  };
631
+ readonly INVALID_NFT_INPUT: {
632
+ readonly phase: 'pre_send';
633
+ readonly template: 'Invalid NFT input {field}: {reason}.';
634
+ readonly params: {
635
+ readonly field: 'string';
636
+ readonly reason: readonly ["not_a_string", "empty", "bad_characters", "not_a_positive_whole_number", "above_mint_limit", "bad_public_key", "bad_authorities", "bad_collection_name"];
637
+ };
638
+ };
624
639
  readonly NO_TOKEN_NAME_RESOLVER: {
625
640
  readonly phase: 'pre_send';
626
641
  readonly template: 'The token name "{tokenName}" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.';
@@ -1008,6 +1023,7 @@ export declare const GALA_ERROR_PHASE_BY_CODE: {
1008
1023
  readonly INVALID_TOKEN_BATCH: 'pre_send';
1009
1024
  readonly INVALID_LOCK_EXPIRES: 'pre_send';
1010
1025
  readonly INVALID_LOCK_NAME: 'pre_send';
1026
+ readonly INVALID_NFT_INPUT: 'pre_send';
1011
1027
  readonly NO_TOKEN_NAME_RESOLVER: 'pre_send';
1012
1028
  readonly TOKEN_NAME_RESOLUTION_FAILED: 'pre_send';
1013
1029
  readonly GATEWAY_WRITE_OUTCOME_UNKNOWN: 'in_flight';
@@ -2649,9 +2665,9 @@ interface GatewayWritesOptions {
2649
2665
  /**
2650
2666
  * What a gateway write returns once GalaChain accepted it (`Status: 1`).
2651
2667
  */
2652
- interface GatewayWriteReceipt {
2668
+ interface WriteReceipt<M extends string> {
2653
2669
  /** The method that was submitted. */
2654
- readonly method: GatewayWriteMethod;
2670
+ readonly method: M;
2655
2671
  /** The `uniqueKey` that was signed (the minted one when the caller gave none). */
2656
2672
  readonly uniqueKey: string;
2657
2673
  /**
@@ -2667,8 +2683,134 @@ interface GatewayWriteReceipt {
2667
2683
  /** The whole parsed answer. */
2668
2684
  readonly body: unknown;
2669
2685
  }
2686
+ /** What a token write (transfer, burn, lock, unlock) returns once GalaChain accepted it. */
2687
+ type GatewayWriteReceipt = WriteReceipt<GatewayWriteMethod>;
2688
+ //#endregion
2689
+ //#region src/writes/nft.d.ts
2690
+ /**
2691
+ * The NFT methods of GalaChain's token contract that `GatewayWrites` signs and submits, as a closed
2692
+ * set: claim a collection name (`GrantNftCollectionAuthorization`), create the NFT collection's
2693
+ * token class (`CreateNftCollection`), mint NFTs, granting the minter its own mint allowance in
2694
+ * the same transaction (`MintTokenWithAllowance`) or against an allowance it already holds
2695
+ * (`MintToken`).
2696
+ */
2697
+ export declare const NFT_WRITE_METHODS: readonly ['GrantNftCollectionAuthorization', 'CreateNftCollection', 'MintTokenWithAllowance', 'MintToken'];
2698
+ /** One member of {@link NFT_WRITE_METHODS}. */
2699
+ type NftWriteMethod = (typeof NFT_WRITE_METHODS)[number];
2700
+ /** The most NFTs one mint may create (the chain's `MintTokenDto.MAX_NFT_MINT_SIZE`). */
2701
+ export declare const NFT_MINT_LIMIT = 1000;
2702
+ /** The `additionalKey` an NFT token class carries when its creator names none (GalaChain's `none`). */
2703
+ export declare const NFT_DEFAULT_ADDITIONAL_KEY = "none";
2704
+ /** The four parts of the NFT token class a write names; `additionalKey` defaults to `none`. */
2705
+ interface NftTokenClassInput {
2706
+ /** The NFT collection name (the one claimed with `claimNftCollection`). */
2707
+ collection: string;
2708
+ /** The category of the token class. */
2709
+ category: string;
2710
+ /** The type of the token class. */
2711
+ type: string;
2712
+ /** The additional key of the token class; default `none`. */
2713
+ additionalKey?: string | undefined;
2714
+ }
2715
+ /** `claimNftCollection`: authorize a user to create token classes under a collection name. */
2716
+ interface ClaimNftCollectionInput extends WriteKeyInput {
2717
+ /** The collection name to claim. The chain refuses a name that is taken (case-insensitively). */
2718
+ collection: string;
2719
+ /**
2720
+ * Who is authorized to create the collection: a user reference in any of the forms of
2721
+ * `TransferGalaInput.to`; default the writer. The chain stores the authorization under the
2722
+ * account the reference names (an `eth|` reference becomes that account's `client|` alias).
2723
+ */
2724
+ authorizedUser?: string | undefined;
2725
+ }
2726
+ /** `createNftCollection`: create the token class of an NFT collection the writer is authorized for. */
2727
+ interface CreateNftCollectionInput extends NftTokenClassInput, WriteKeyInput {
2728
+ /** The token class's name. */
2729
+ name: string;
2730
+ /** The token class's symbol (a string; it may be empty). */
2731
+ symbol: string;
2732
+ /** The token class's description. */
2733
+ description: string;
2734
+ /** The token class's image URL. */
2735
+ image: string;
2736
+ /**
2737
+ * The most NFTs that may ever exist, a positive whole number as a decimal string. Required: the
2738
+ * chain refuses an NFT class whose supply is unbounded ("maxSupply must be finite").
2739
+ */
2740
+ maxSupply: string;
2741
+ /** The most NFTs that may be held at once, a positive whole number as a decimal string. */
2742
+ maxCapacity?: string | undefined;
2743
+ /** An optional metadata address. */
2744
+ metadataAddress?: string | undefined;
2745
+ /** An optional contract address. */
2746
+ contractAddress?: string | undefined;
2747
+ /** An optional rarity label. */
2748
+ rarity?: string | undefined;
2749
+ /**
2750
+ * The token authorities, as user references. Default (when omitted): the writer. They are the
2751
+ * accounts that may mint; naming others without the writer makes the writer unable to mint.
2752
+ */
2753
+ authorities?: readonly string[] | undefined;
2754
+ }
2755
+ /** `mintNft`: mint NFTs of a token class the writer is a token authority of. */
2756
+ interface MintNftInput extends NftTokenClassInput, WriteKeyInput {
2757
+ /** How many NFTs to mint, a whole number from 1 to {@link NFT_MINT_LIMIT} as a decimal string. */
2758
+ quantity: string;
2759
+ /** Who receives them: a user reference; default the writer. */
2760
+ owner?: string | undefined;
2761
+ /**
2762
+ * `false` (default): `MintTokenWithAllowance`, which grants the writer its own mint allowance in
2763
+ * the same transaction. `true`: `MintToken`, which spends a mint allowance the writer already
2764
+ * holds and is refused (`INSUFFICIENT_MINT_ALLOWANCE`) without one.
2765
+ */
2766
+ existingAllowance?: boolean | undefined;
2767
+ }
2768
+ /** What a claim returned: the collection and every account now authorized for it. */
2769
+ type ClaimNftCollectionReceipt = WriteReceipt<'GrantNftCollectionAuthorization'> & {
2770
+ readonly collection: string;
2771
+ readonly authorizedUsers: readonly string[];
2772
+ };
2773
+ /** What a create returned: the token class it created. */
2774
+ type CreateNftCollectionReceipt = WriteReceipt<'CreateNftCollection'> & {
2775
+ readonly tokenClass: Readonly<GalaChainTokenClassKey>;
2776
+ };
2777
+ /** What a mint returned: the NFT instances it created, in the chain's order. */
2778
+ type MintNftReceipt = WriteReceipt<'MintTokenWithAllowance' | 'MintToken'> & {
2779
+ readonly tokenInstances: readonly GalaChainTokenInstanceKey[];
2780
+ };
2781
+ //#endregion
2782
+ //#region src/writes/nft_fee.d.ts
2783
+ /** One fee the simulated write would pay. */
2784
+ interface NftFeeReceipt {
2785
+ /** The chain's fee code (`NftCollectionAuthorization`, `CreateNftCollection`, ...). */
2786
+ readonly feeCode: string;
2787
+ /** The fee in whole GALA, a decimal string. */
2788
+ readonly quantity: string;
2789
+ }
2790
+ /** What GalaChain's DryRun says a write would cost. */
2791
+ interface NftFeeQuote {
2792
+ /** The method that was simulated. */
2793
+ readonly method: NftWriteMethod;
2794
+ /** The network fee in GALA, a decimal string; `"0"` only when the chain wrote no fee receipt. */
2795
+ readonly fee: string;
2796
+ /** The fee token: always GALA. */
2797
+ readonly feeToken: 'GALA';
2798
+ /** The fees the fee is the sum of, as the chain simulated them. */
2799
+ readonly receipts: readonly NftFeeReceipt[];
2800
+ }
2670
2801
  //#endregion
2671
2802
  //#region src/writes/gateway_writes.d.ts
2803
+ /**
2804
+ * What `estimateNftFee` prices: the input of one NFT write, named by the write's method. It takes the
2805
+ * same checks as the write.
2806
+ */
2807
+ type NftFeeRequest = ({
2808
+ write: 'claimNftCollection';
2809
+ } & ClaimNftCollectionInput) | ({
2810
+ write: 'createNftCollection';
2811
+ } & CreateNftCollectionInput) | ({
2812
+ write: 'mintNft';
2813
+ } & MintNftInput);
2672
2814
  /**
2673
2815
  * Signed GalaChain token-contract writes through the gateway: transfer GALA, transfer a token,
2674
2816
  * burn, lock and unlock. React Native safe (no Node builtins, no ethers, no `@gala-chain/api`).
@@ -2735,6 +2877,51 @@ export declare class GatewayWrites {
2735
2877
  * @throws GalaSDKError as {@link burnTokens}, plus `INVALID_LOCK_NAME`.
2736
2878
  */
2737
2879
  unlockTokens(input: UnlockTokensInput): Promise<GatewayWriteReceipt>;
2880
+ /**
2881
+ * Claim an NFT collection name: authorize `authorizedUser` (default the writer) to create token
2882
+ * classes under it. The chain charges its claim fee (see {@link estimateNftFee}) and refuses a
2883
+ * name that is taken, whatever its casing.
2884
+ *
2885
+ * @throws GalaSDKError pre-send: `INVALID_NFT_INPUT`, `INVALID_WALLET_ADDRESS`,
2886
+ * `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight: `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check
2887
+ * `error.uniqueKey`; never resend under a fresh key); post-send: `GATEWAY_WRITE_REJECTED`,
2888
+ * `GATEWAY_HTTP_ERROR`, `GATEWAY_RESPONSE_INVALID` (also an answer for another collection).
2889
+ */
2890
+ claimNftCollection(input: ClaimNftCollectionInput): Promise<ClaimNftCollectionReceipt>;
2891
+ /**
2892
+ * Create the token class of an NFT collection the writer is authorized for (`CreateNftCollection`).
2893
+ *
2894
+ * @throws GalaSDKError as {@link claimNftCollection}.
2895
+ */
2896
+ createNftCollection(input: CreateNftCollectionInput): Promise<CreateNftCollectionReceipt>;
2897
+ /**
2898
+ * Mint 1 to 1000 NFTs of a token class the writer is a token authority of, to `owner` (default
2899
+ * the writer). The receipt lists the instances the chain created, as the chain answered them.
2900
+ *
2901
+ * @throws GalaSDKError as {@link claimNftCollection}.
2902
+ */
2903
+ mintNft(input: MintNftInput): Promise<MintNftReceipt>;
2904
+ /**
2905
+ * What GalaChain's DryRun says an NFT write would cost, for the same input the write takes,
2906
+ * checked the same way, and with nothing written to the chain. The fee is the network's own
2907
+ * figure for this environment (it differs between stage and mainnet), never a constant.
2908
+ *
2909
+ * `callerPublicKey` is the writer's secp256k1 public key (hex): the chain's DryRun needs a caller
2910
+ * and a signer is not asked for its key. A write the chain would refuse (no authorization, no
2911
+ * balance, no mint allowance) is `GATEWAY_READ_REJECTED`, never a fee.
2912
+ *
2913
+ * @throws GalaSDKError the input checks of the write; `INVALID_NFT_INPUT` for a bad key;
2914
+ * `SIGNING_FAILED`; `REQUEST_TIMEOUT` / `TRANSPORT_ERROR` (`write: false`); `GATEWAY_HTTP_ERROR`;
2915
+ * `GATEWAY_READ_REJECTED`; `GATEWAY_READ_RESPONSE_INVALID`.
2916
+ */
2917
+ estimateNftFee(request: NftFeeRequest, options: {
2918
+ readonly callerPublicKey: string;
2919
+ }): Promise<NftFeeQuote>;
2920
+ private prepareFeeRequest;
2921
+ /** Everything a claim needs, every input checked before the key is spent. */
2922
+ private prepareClaim;
2923
+ private prepareCreate;
2924
+ private prepareMint;
2738
2925
  /** The caller's key, checked, or a fresh one. */
2739
2926
  private uniqueKeyOf;
2740
2927
  /** Every token and quantity of a batch write, checked synchronously, in order. */
@@ -3114,6 +3301,71 @@ export declare class GatewayReads {
3114
3301
  private readAllPages;
3115
3302
  }
3116
3303
  //#endregion
3304
+ //#region src/reads/nft_collections.d.ts
3305
+ interface NftCollectionAuthorization {
3306
+ authorizedUser: string;
3307
+ collection: string;
3308
+ created?: number;
3309
+ }
3310
+ interface FetchNftTokenClassesParams {
3311
+ collection: string;
3312
+ type?: string;
3313
+ category?: string;
3314
+ }
3315
+ interface NftTokenClassWithSupply {
3316
+ collection: string;
3317
+ type: string;
3318
+ category: string;
3319
+ additionalKey: string;
3320
+ totalSupply: string;
3321
+ maxSupply?: string;
3322
+ isNonFungible: boolean;
3323
+ name?: string;
3324
+ description?: string;
3325
+ image?: string;
3326
+ symbol?: string;
3327
+ rarity?: string;
3328
+ }
3329
+ interface NftBalance {
3330
+ owner: string;
3331
+ collection: string;
3332
+ category: string;
3333
+ type: string;
3334
+ additionalKey: string;
3335
+ instanceIds: string[];
3336
+ totalOwned: number;
3337
+ }
3338
+ /** NFT collection reads in Launchpad result shapes, using a shared gateway reader. */
3339
+ export declare class NftCollectionReads {
3340
+ private readonly reads;
3341
+ constructor(reads: GatewayReads);
3342
+ fetchNftCollections(walletAddress: string): Promise<NftCollectionAuthorization[]>;
3343
+ isNftCollectionAvailable(name: string): Promise<boolean>;
3344
+ fetchNftTokenClasses(params: FetchNftTokenClassesParams): Promise<NftTokenClassWithSupply[]>;
3345
+ fetchNftBalances(ownerAddress: string, collectionFilter?: string): Promise<NftBalance[]>;
3346
+ }
3347
+ //#endregion
3348
+ //#region src/reads/nft_fees.d.ts
3349
+ /** Fixed GalaChain NFT operation fees, denominated in GALA. */
3350
+ interface EstimateNftFeesParams {
3351
+ claimCollection?: boolean;
3352
+ createTokenClasses?: number;
3353
+ }
3354
+ interface NftFeeBreakdown {
3355
+ collectionClaim?: string;
3356
+ tokenClassCreate?: string;
3357
+ tokenClassCount?: number;
3358
+ mintFee?: string;
3359
+ }
3360
+ interface NftFeeEstimate {
3361
+ totalFee: string;
3362
+ breakdown: NftFeeBreakdown;
3363
+ }
3364
+ export declare function getNftCollectionClaimFee(): string;
3365
+ export declare function getNftTokenClassCreateFee(): string;
3366
+ /** Calculate the fixed fees for the requested collection and token-class operations. */
3367
+ export declare function estimateNftOperationFees(params: EstimateNftFeesParams): NftFeeEstimate;
3368
+ //#endregion
3117
3369
  //#region src/config/environments.d.ts
3118
3370
  /** A GalaChain deployment: `prod` (mainnet) or `stage` (testnet). */
3119
3371
  type GalaChainEnv = 'prod' | 'stage';
@@ -3203,5 +3455,5 @@ export declare function walletDeclineCode(value: unknown): number | string | und
3203
3455
  */
3204
3456
  export declare const GALA_CORE_SDK_VERSION: string;
3205
3457
  //#endregion
3206
- export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, EIP712DomainValue, EIP712Types, ErrorParamsOf, FailureOutcome, FailureView, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput };
3458
+ export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, ClaimNftCollectionInput, ClaimNftCollectionReceipt, CreateNftCollectionInput, CreateNftCollectionReceipt, EIP712DomainValue, EIP712Types, ErrorParamsOf, EstimateNftFeesParams, FailureOutcome, FailureView, FetchNftTokenClassesParams, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidNftInputReason, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, MintNftInput, MintNftReceipt, NftBalance, NftCollectionAuthorization, NftFeeBreakdown, NftFeeEstimate, NftFeeQuote, NftFeeReceipt, NftFeeRequest, NftTokenClassInput, NftTokenClassWithSupply, NftWriteMethod, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput, WriteReceipt };
3207
3459
  //# sourceMappingURL=index.d.ts.map