@gala-chain/gala-core-sdk 1.0.0-rc.6 → 1.0.0-rc.8
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 +15 -10
- package/dist/bridge.cjs +1 -1
- package/dist/bridge.cjs.map +1 -1
- package/dist/bridge.d.cts +3 -3
- package/dist/bridge.d.ts +3 -3
- package/dist/bridge.mjs +1 -1
- package/dist/bridge.mjs.map +1 -1
- package/dist/browser/bridge.js.map +1 -1
- 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/classes/signers.js +1 -1
- package/dist/browser/classes/signers.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/providers.js +1 -1
- package/dist/browser/providers.js.map +1 -1
- package/dist/browser/reads/gateway_reads.js +1 -1
- package/dist/browser/reads/types.js.map +1 -1
- package/dist/browser/utils/chain_dto_signing.js.map +1 -1
- package/dist/browser/utils/eip712.js.map +1 -1
- package/dist/browser/utils/failure_view.js.map +1 -1
- package/dist/browser/utils/signing.js +2 -2
- package/dist/browser/utils/signing.js.map +1 -1
- package/dist/browser/utils/transport.js +1 -1
- package/dist/browser/utils/typed_data.js +1 -1
- package/dist/browser/utils/typed_data.js.map +1 -1
- package/dist/browser/utils/unique_key.js.map +1 -1
- package/dist/browser/utils/wallet_keys.js +1 -1
- package/dist/browser/utils/wallet_rejection.js.map +1 -1
- package/dist/browser/version.js +1 -1
- package/dist/browser/version.js.map +1 -1
- package/dist/browser/wallet.js.map +1 -1
- package/dist/browser/writes/gateway_writes.js +1 -1
- package/dist/browser/writes/identity.js +1 -1
- package/dist/browser/writes/identity.js.map +1 -1
- package/dist/browser/writes/types.js.map +1 -1
- package/dist/index.cjs +183 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -36
- package/dist/index.d.ts +54 -36
- package/dist/index.mjs +183 -144
- package/dist/index.mjs.map +1 -1
- package/dist/providers.cjs +6 -2
- package/dist/providers.cjs.map +1 -1
- package/dist/providers.d.cts +4 -1
- package/dist/providers.d.ts +4 -1
- package/dist/providers.mjs +6 -2
- package/dist/providers.mjs.map +1 -1
- package/dist/wallet.cjs +1 -1
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.mjs +1 -1
- package/dist/wallet.mjs.map +1 -1
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ timeouts, wire options, axios and ethers adapters), the gateway token reads (bal
|
|
|
7
7
|
token classes, NFT collection authorizations) and writes (transfer, burn, lock, unlock), token
|
|
8
8
|
class keys and write `uniqueKey`s, and the shared error model (`GalaSDKError`, its
|
|
9
9
|
catalog, the failure view). It speaks to the GalaChain
|
|
10
|
-
gateway generically; product backends (
|
|
10
|
+
gateway generically; product backends (the DEX and Launchpad backends) have their own SDKs
|
|
11
11
|
(`@gala-chain/gswap-sdk`, `@gala-chain/launchpad-sdk`) that build on it.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
@@ -43,7 +43,6 @@ key.fill(0);
|
|
|
43
43
|
| Transport | `fetchRequestor`, `requestWithTimeout` (`kind: { write: false }` makes a read's timeout and transport failure say `write: false`), `buildRequestHeaders`, `buildQueryString`, `readRetryAfter`, `httpRequestorFromAxios`, `eip1193ProviderFromEthers`, `isFetchTransportFailure`, types `HttpRequestor`, `WireOptions`, `RequestKind` |
|
|
44
44
|
| Gateway reads | `GatewayReads` (`fetchBalances`, `fetchTokenBalance`, `fetchNftBalances`, `fetchTokenClasses`, `fetchTokenClassesWithSupply`, `fetchTokenClass`, `fetchTokenDetails`, `fetchTokenClassesPage`, `fetchAllTokenClasses`, `fetchNftCollectionAuthorizationsPage`, `fetchAllNftCollectionAuthorizations`, `fetchPublicKey`), `GATEWAY_READ_METHODS`, `GATEWAY_READ_LIMITS`, types `GalaChainTokenBalance`, `GalaChainTokenBalanceSummary`, `GalaChainTokenClass`, `GalaChainTokenDetails`, `GalaChainPage`, `GalaChainPublicKey` |
|
|
45
45
|
| Gateway writes | `GatewayWrites` (`transferGala`, `transferToken`, `burnTokens`, `lockTokens`, `unlockTokens`), `galaChainUserRef` (a user reference in the one spelling the gateway accepts), `GATEWAY_WRITE_METHODS`, `GATEWAY_WRITE_BATCH_LIMITS`, `GALA_TOKEN_CLASS_KEY`, types `GatewayWritesOptions`, `GatewayWriteReceipt`, `TokenNameResolver`, `TokenQuantityInput` |
|
|
46
|
-
| Gateway reads | `GatewayReads` (`fetchBalances`, `fetchTokenBalance`, `fetchNftBalances`, `fetchTokenClasses`, `fetchTokenClassesWithSupply`, `fetchTokenClass`, `fetchTokenDetails`, `fetchTokenClassesPage`, `fetchAllTokenClasses`, `fetchNftCollectionAuthorizationsPage`, `fetchAllNftCollectionAuthorizations`, `fetchPublicKey`), `GATEWAY_READ_METHODS`, `GATEWAY_READ_LIMITS`, types `GalaChainTokenBalance`, `GalaChainTokenBalanceSummary`, `GalaChainTokenClass`, `GalaChainTokenDetails`, `GalaChainPage`, `GalaChainPublicKey` |
|
|
47
46
|
| Deployments | `GALA_CHAIN_ENVIRONMENTS` (gateway and DEX API of `prod` / `stage`) |
|
|
48
47
|
| Keys | `compositeKeyOf`, `tryParseTokenClassKey`, `tryParseCompositeKey`, `createUniqueKey`, `assertUniqueKey`, `isValidUniqueKey` |
|
|
49
48
|
| Wallets | `createWallet` (random, from a private key, or from a 12/24-word mnemonic at `m/44'/60'/0'/0/0`), `validateWalletInput`, `getPublicKeyFromPrivateKey`, `getEthereumAddressFromPrivateKey`, `checksumEthereumAddress`, types `GeneratedWallet`, `PublicKeyResult` |
|
|
@@ -110,7 +109,9 @@ TypeScript 6, `"types": ["node"]`) or `skipLibCheck`. The other entries need no
|
|
|
110
109
|
import { detectWallets, ExternalWalletProvider, PrivateKeyProvider } from '@gala-chain/gala-core-sdk/providers';
|
|
111
110
|
|
|
112
111
|
const { wallets } = await detectWallets(); // EIP-6963 announcements, then window.ethereum / window.gala
|
|
113
|
-
const
|
|
112
|
+
const first = wallets[0];
|
|
113
|
+
if (first === undefined) throw new Error('No wallet announced itself');
|
|
114
|
+
const provider = new ExternalWalletProvider(first.provider);
|
|
114
115
|
await provider.connect();
|
|
115
116
|
await provider.signMessage('Hello'); // personal_sign
|
|
116
117
|
const signer = provider.getSigner(); // a GalaChainSigner for GatewayWrites, gswap-sdk, ...
|
|
@@ -174,8 +175,12 @@ await writes.lockTokens({ tokens: [{ tokenClassKey: 'GALA|Unit|none|none', quant
|
|
|
174
175
|
`$` composite key, or the object) plus `instance` (default `"0"`), or `tokenName` through an
|
|
175
176
|
optional `tokenNameResolver`. A bare symbol is never a class key.
|
|
176
177
|
- Identities (`to`, `walletAddress`, `lockAuthority`): an Ethereum account (`eth|<40 hex>`,
|
|
177
|
-
`
|
|
178
|
-
|
|
178
|
+
`0x<40 hex>`, bare hex; any casing but a wrong EIP-55 checksum) is always sent as
|
|
179
|
+
`eth|<checksummed>`, the only spelling the gateway accepts; `client|<id>` is sent as written.
|
|
180
|
+
`eth|0x<hex>` is **not** an address form: it is refused before anything is signed or sent with
|
|
181
|
+
`INVALID_ETH_USER_REF_PREFIX` (an `eth|` reference takes the 40 digits with no `0x`; the error's
|
|
182
|
+
`expected` is the right spelling). A bare `0x<40 hex>` is an ordinary Ethereum address and is
|
|
183
|
+
converted.
|
|
179
184
|
- The signer is handed the bare DTO; the body sent is exactly the DTO plus the signature (a signer
|
|
180
185
|
that adds or changes a field is refused). A `uniqueKey` is minted per write unless you pass one.
|
|
181
186
|
- GalaChain's `Status` is checked before anything else is trusted; a timeout or broken connection is
|
|
@@ -213,10 +218,10 @@ const classes = await reads.fetchAllTokenClasses({ collection: 'BONKTactics' },
|
|
|
213
218
|
|
|
214
219
|
## Signing parity
|
|
215
220
|
|
|
216
|
-
The signing code is pinned byte-for-byte to `@gala-chain/api
|
|
217
|
-
the golden vectors in `tests/fixtures/wallet-signing-golden.json`
|
|
218
|
-
`tests/fixtures/frontend-signing-golden.json` (`tests/signing-golden.test.ts`). They are never
|
|
219
|
-
regenerated to make a test pass
|
|
221
|
+
The signing code is pinned byte-for-byte to `@gala-chain/api` and to the Gala Wallet's and the
|
|
222
|
+
gSwap web app's signing code by the golden vectors in `tests/fixtures/wallet-signing-golden.json`
|
|
223
|
+
and `tests/fixtures/frontend-signing-golden.json` (`tests/signing-golden.test.ts`). They are never
|
|
224
|
+
regenerated to make a test pass.
|
|
220
225
|
|
|
221
226
|
## React Native
|
|
222
227
|
|
|
@@ -251,7 +256,7 @@ gzipped, before `ethers` and `@solana/*`) are loaded only by an app that imports
|
|
|
251
256
|
|
|
252
257
|
## Status
|
|
253
258
|
|
|
254
|
-
1.0.0-rc.
|
|
259
|
+
<!-- docs:var version -->1.0.0-rc.8<!-- /docs:var --> (rc.7: `eth|0x<hex>` is refused as `INVALID_ETH_USER_REF_PREFIX`, not an address form; rc.6: `fetchPublicKey`, MetaMask and Trust Wallet detection, silent `restore()`;
|
|
255
260
|
rc.5: every Ethereum account a read, write or GalaConnect client sends is
|
|
256
261
|
`eth|<EIP-55>`, the only spelling the gateway accepts, and `galaChainUserRef` is exported; rc.4:
|
|
257
262
|
`bridgeableTokenService` is required). In: signing, signers, transport and the error model (rc.0, from gswap-sdk); the
|
package/dist/bridge.cjs
CHANGED
|
@@ -3802,7 +3802,7 @@ function requireBridgeTokenDescriptor(symbol, network) {
|
|
|
3802
3802
|
* @example
|
|
3803
3803
|
* ```typescript
|
|
3804
3804
|
* const bridgeService = new BridgeService({
|
|
3805
|
-
* galaChainWalletAddress: 'eth|
|
|
3805
|
+
* galaChainWalletAddress: 'eth|1234...',
|
|
3806
3806
|
* ethereumPrivateKey: '0xabcd...',
|
|
3807
3807
|
* solanaPrivateKey: 'base58EncodedKey...',
|
|
3808
3808
|
* bridgeableTokenService,
|