Skip to main content

Class: GatewayWrites

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / index / GatewayWrites

Class: GatewayWrites

Defined in: packages/gala-core-sdk/dist/index.d.ts:2561

Signed GalaChain token-contract writes through the gateway: transfer GALA, transfer a token, burn, lock and unlock. React Native safe (no Node builtins, no ethers, no @gala-chain/api).

Every write is checked completely BEFORE it is signed (recipient and owner spellings, the token, the quantity, the uniqueKey, the batch), so a refused input costs no signature and no request. The DTO is plain JSON with exactly the chain's fields; the signer signs it as it is (nothing, least of all a signer hint, is added) and the body sent is what the signer returned. Quantities are whole tokens and are signed exactly as written.

Example​

const writes = new GatewayWrites({
gatewayBaseUrl: 'https://gateway-mainnet.galachain.com',
signer: new PrivateKeySigner(privateKey),
walletAddress: 'eth|70997970C51812dc3A010C7d01b50e0d17dc79C8',
});
const { transactionId, blockNumber } = await writes.transferGala({ to: 'client|abc', quantity: '1.5' });

Constructors​

Constructor​

new GatewayWrites(options): GatewayWrites

Defined in: packages/gala-core-sdk/dist/index.d.ts:2572

Parameters​

options​

GatewayWritesOptions

Returns​

GatewayWrites

Throws​

GalaSDKError INVALID_WRITES_OPTION (a missing signer or base URL, a requestor that is not a function, a resolver without resolveTokenClassKey), INVALID_WALLET_ADDRESS, INVALID_TIMEOUT, INVALID_UNIQUE_KEY_PREFIX.

Properties​

walletAddress​

readonly walletAddress: string

Defined in: packages/gala-core-sdk/dist/index.d.ts:2563

The identity every write is made as, in the spelling the gateway receives.

Methods​

burnTokens()​

burnTokens(input): Promise<GatewayWriteReceipt>

Defined in: packages/gala-core-sdk/dist/index.d.ts:2594

Burn 1 to 50 tokens of the writer's. IRREVERSIBLE: burned tokens are gone.

Parameters​

input​

BurnTokensInput

Returns​

Promise<GatewayWriteReceipt>

Throws​

GalaSDKError as transferToken, plus INVALID_TOKEN_BATCH.


lockTokens()​

lockTokens(input): Promise<GatewayWriteReceipt>

Defined in: packages/gala-core-sdk/dist/index.d.ts:2600

Lock 1 to 100 tokens of the writer's under one hold.

Parameters​

input​

LockTokensInput

Returns​

Promise<GatewayWriteReceipt>

Throws​

GalaSDKError as burnTokens, plus INVALID_LOCK_EXPIRES, INVALID_LOCK_NAME.


transferGala()​

transferGala(input): Promise<GatewayWriteReceipt>

Defined in: packages/gala-core-sdk/dist/index.d.ts:2581

Transfer GALA (GALA|Unit|none|none, instance "0") to to.

Parameters​

input​

TransferGalaInput

Returns​

Promise<GatewayWriteReceipt>

Throws​

GalaSDKError pre-send: INVALID_WALLET_ADDRESS, INVALID_QUANTITY, INVALID_UNIQUE_KEY, SIGNING_FAILED; in flight: GATEWAY_WRITE_OUTCOME_UNKNOWN (check error.uniqueKey; never resend under a fresh key); post-send: GATEWAY_WRITE_REJECTED, GATEWAY_HTTP_ERROR, GATEWAY_RESPONSE_INVALID.


transferToken()​

transferToken(input): Promise<GatewayWriteReceipt>

Defined in: packages/gala-core-sdk/dist/index.d.ts:2588

Transfer one token to to.

Parameters​

input​

TransferTokenInput

Returns​

Promise<GatewayWriteReceipt>

Throws​

GalaSDKError as transferGala, plus INVALID_TOKEN_REFERENCE, NO_TOKEN_NAME_RESOLVER, TOKEN_NAME_RESOLUTION_FAILED.


unlockTokens()​

unlockTokens(input): Promise<GatewayWriteReceipt>

Defined in: packages/gala-core-sdk/dist/index.d.ts:2606

Unlock 1 to 100 tokens of the writer's from their hold.

Parameters​

input​

UnlockTokensInput

Returns​

Promise<GatewayWriteReceipt>

Throws​

GalaSDKError as burnTokens, plus INVALID_LOCK_NAME.