@gala-chain/gala-core-sdk 1.0.0-rc.5 → 1.0.0-rc.7

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.
Files changed (56) hide show
  1. package/README.md +16 -6
  2. package/dist/bridge.cjs +1 -1
  3. package/dist/bridge.cjs.map +1 -1
  4. package/dist/bridge.d.cts +3 -3
  5. package/dist/bridge.d.ts +3 -3
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/bridge.mjs.map +1 -1
  8. package/dist/browser/bridge.js.map +1 -1
  9. package/dist/browser/classes/error_catalog.js +1 -1
  10. package/dist/browser/classes/error_catalog.js.map +1 -1
  11. package/dist/browser/classes/error_phase_table.js +1 -1
  12. package/dist/browser/classes/error_phase_table.js.map +1 -1
  13. package/dist/browser/classes/signers.js +1 -1
  14. package/dist/browser/classes/signers.js.map +1 -1
  15. package/dist/browser/index.js +1 -1
  16. package/dist/browser/providers.js +1 -1
  17. package/dist/browser/providers.js.map +1 -1
  18. package/dist/browser/react.js +1 -1
  19. package/dist/browser/react.js.map +1 -1
  20. package/dist/browser/reads/gateway_reads.js +1 -1
  21. package/dist/browser/reads/gateway_reads.js.map +1 -1
  22. package/dist/browser/reads/parse.js +1 -1
  23. package/dist/browser/reads/parse.js.map +1 -1
  24. package/dist/browser/reads/request.js +1 -1
  25. package/dist/browser/reads/request.js.map +1 -1
  26. package/dist/browser/reads/types.js +1 -1
  27. package/dist/browser/reads/types.js.map +1 -1
  28. package/dist/browser/utils/signing.js +2 -2
  29. package/dist/browser/utils/transport.js +1 -1
  30. package/dist/browser/utils/typed_data.js +1 -1
  31. package/dist/browser/utils/wallet_keys.js +1 -1
  32. package/dist/browser/version.js +1 -1
  33. package/dist/browser/version.js.map +1 -1
  34. package/dist/browser/writes/gateway_writes.js +1 -1
  35. package/dist/browser/writes/identity.js +1 -1
  36. package/dist/browser/writes/identity.js.map +1 -1
  37. package/dist/browser/writes/types.js.map +1 -1
  38. package/dist/index.cjs +225 -111
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +75 -23
  41. package/dist/index.d.ts +75 -23
  42. package/dist/index.mjs +225 -111
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/providers.cjs +149 -8
  45. package/dist/providers.cjs.map +1 -1
  46. package/dist/providers.d.cts +67 -1
  47. package/dist/providers.d.ts +67 -1
  48. package/dist/providers.mjs +146 -9
  49. package/dist/providers.mjs.map +1 -1
  50. package/dist/react.cjs +58 -24
  51. package/dist/react.cjs.map +1 -1
  52. package/dist/react.d.cts +7 -1
  53. package/dist/react.d.ts +7 -1
  54. package/dist/react.mjs +58 -24
  55. package/dist/react.mjs.map +1 -1
  56. package/package.json +1 -1
package/README.md CHANGED
@@ -41,14 +41,15 @@ key.fill(0);
41
41
  | Signers | `PrivateKeySigner`, `createLazyPrivateKeySigner`, `GalaWalletSigner`, `BrowserWalletSigner`, `signPreSend`, type `GalaChainSigner` |
42
42
  | Signing | `serialize`, `getPayloadToSign`, `signNative`, `signPersonalMessage`, `personalSignPrefixFor`, `fixpointPrefixFor`, `signChainDto*`, `signRawObject`, `generateEIP712Types`, `buildEIP712Payload`, `hashTypedData`, `signTypedDataPayload` |
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
+ | 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` |
44
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` |
45
- | Gateway reads | `GatewayReads` (`fetchBalances`, `fetchTokenBalance`, `fetchNftBalances`, `fetchTokenClasses`, `fetchTokenClassesWithSupply`, `fetchTokenClass`, `fetchTokenDetails`, `fetchTokenClassesPage`, `fetchAllTokenClasses`, `fetchNftCollectionAuthorizationsPage`, `fetchAllNftCollectionAuthorizations`), `GATEWAY_READ_METHODS`, `GATEWAY_READ_LIMITS`, types `GalaChainTokenBalance`, `GalaChainTokenBalanceSummary`, `GalaChainTokenClass`, `GalaChainTokenDetails`, `GalaChainPage` |
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` |
46
47
  | Deployments | `GALA_CHAIN_ENVIRONMENTS` (gateway and DEX API of `prod` / `stage`) |
47
48
  | Keys | `compositeKeyOf`, `tryParseTokenClassKey`, `tryParseCompositeKey`, `createUniqueKey`, `assertUniqueKey`, `isValidUniqueKey` |
48
49
  | 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` |
49
50
  | Errors | `GalaSDKError`, `isGalaError`, `GALA_ERROR_CATALOG`, `galaErrorTemplates`, `GALA_ERROR_PHASE_BY_CODE`, `toFailureView`, `isWriteView`, `FAILURE_OUTCOMES` |
50
51
  | Wallet helpers (`./wallet`) | `isWalletUserRejection`, `walletDeclineCode`, `isGalaErrorLike` |
51
- | Wallet providers (`./providers`) | `PrivateKeyProvider`, `ExternalWalletProvider`, `GalaWalletProvider`, `detectWallets`, `subscribeToWalletChanges`, `getWalletByRdns`, `isWalletAvailable`, `hasAnyWallet`, `getInjectedEip1193Provider`, `KNOWN_WALLET_RDNS`, `createWalletProvider`, `createProviderFromEip1193`, `ensureConnected`, `getPrivateKeyIfAvailable`, `isPrivateKeyProvider`, `isExternalProvider`, `isEip1193Provider`, type `WalletProvider` |
52
+ | Wallet providers (`./providers`) | `PrivateKeyProvider`, `ExternalWalletProvider`, `GalaWalletProvider`, `detectWallets`, `subscribeToWalletChanges`, `getWalletByRdns`, `isWalletAvailable`, `findMetaMaskWallet`, `getMetaMaskWallet`, `findTrustWallet`, `getTrustWallet`, `hasAnyWallet`, `getInjectedEip1193Provider`, `KNOWN_WALLET_RDNS`, `createWalletProvider`, `createProviderFromEip1193`, `ensureConnected`, `getPrivateKeyIfAvailable`, `isPrivateKeyProvider`, `isExternalProvider`, `isEip1193Provider`, type `WalletProvider` |
52
53
  | React (`./react`) | `WalletProvider` (context component), `WalletContext`, `useWallet`, `useWalletContext`, `useWalletConnection`, `useWalletDetection`, `useWalletAddress`, `useGalaAddress`, `useWalletProvider`, `useIsWalletConnected` |
53
54
  | Bridge (`./bridge`) | `BridgeService` (bridge out to and in from Ethereum and Solana, fees, status, external balances), `EthereumBridgeStrategy`, `SolanaBridgeStrategy`, `BaseBridgeStrategy`, `GalaConnectClient`, `BridgeableTokenService`, `WrappableTokenService`, `WrapService` (channel wrap / unwrap), `createSolanaWallet`, `buildBridgeOutPayload` (the signed bridge-out request), the bridge constants and token tables, the bridge types, `RateLimiter`, the token amount helpers (`toBaseUnits`, `fromBaseUnits`, `formatTokenAmount`, `compareAmounts`) |
54
55
 
@@ -173,8 +174,12 @@ await writes.lockTokens({ tokens: [{ tokenClassKey: 'GALA|Unit|none|none', quant
173
174
  `$` composite key, or the object) plus `instance` (default `"0"`), or `tokenName` through an
174
175
  optional `tokenNameResolver`. A bare symbol is never a class key.
175
176
  - Identities (`to`, `walletAddress`, `lockAuthority`): an Ethereum account (`eth|<40 hex>`,
176
- `eth|0x<40 hex>`, `0x<40 hex>`, bare hex; any casing but a wrong EIP-55 checksum) is always sent
177
- as `eth|<checksummed>`, the only spelling the gateway accepts; `client|<id>` is sent as written.
177
+ `0x<40 hex>`, bare hex; any casing but a wrong EIP-55 checksum) is always sent as
178
+ `eth|<checksummed>`, the only spelling the gateway accepts; `client|<id>` is sent as written.
179
+ `eth|0x<hex>` is **not** an address form: it is refused before anything is signed or sent with
180
+ `INVALID_ETH_USER_REF_PREFIX` (an `eth|` reference takes the 40 digits with no `0x`; the error's
181
+ `expected` is the right spelling). A bare `0x<40 hex>` is an ordinary Ethereum address and is
182
+ converted.
178
183
  - The signer is handed the bare DTO; the body sent is exactly the DTO plus the signature (a signer
179
184
  that adds or changes a field is refused). A `uniqueKey` is minted per write unless you pass one.
180
185
  - GalaChain's `Status` is checked before anything else is trusted; a timeout or broken connection is
@@ -205,6 +210,10 @@ const classes = await reads.fetchAllTokenClasses({ collection: 'BONKTactics' },
205
210
  strings; hold totals are exact and never in exponent form.
206
211
  - A token class that does not exist is `TOKEN_CLASS_NOT_FOUND`; a `fetchAll...` read that would
207
212
  need more than `maxPages` pages is `PAGINATION_LIMIT_EXCEEDED` (never a truncated list).
213
+ - `fetchPublicKey(user)` reads the key GalaChain has registered for a user (`{ publicKey,
214
+ signing? }`, `undefined` when none is saved). The public gateways do not route the
215
+ public-key-contract; read it through a connect-api proxy:
216
+ `new GatewayReads({ gatewayBaseUrl: 'https://api-galaswap.gala.com/galachain' })`.
208
217
 
209
218
  ## Signing parity
210
219
 
@@ -246,8 +255,9 @@ gzipped, before `ethers` and `@solana/*`) are loaded only by an app that imports
246
255
 
247
256
  ## Status
248
257
 
249
- 1.0.0-rc.5 (rc.5: every Ethereum account a read, write or GalaConnect client sends is
250
- `eth|<EIP-55>`, the only spelling the gateway accepts; `galaChainUserRef` is exported. rc.4:
258
+ 1.0.0-rc.7 (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()`;
259
+ rc.5: every Ethereum account a read, write or GalaConnect client sends is
260
+ `eth|<EIP-55>`, the only spelling the gateway accepts, and `galaChainUserRef` is exported; rc.4:
251
261
  `bridgeableTokenService` is required). In: signing, signers, transport and the error model (rc.0, from gswap-sdk); the
252
262
  gateway token writes (rc.1, from launchpad-sdk's transfer and lock services, which now delegate
253
263
  here); the gateway token reads (rc.2: balances, token classes, NFT collection authorizations, from
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|0x1234...',
3805
+ * galaChainWalletAddress: 'eth|1234...',
3806
3806
  * ethereumPrivateKey: '0xabcd...',
3807
3807
  * solanaPrivateKey: 'base58EncodedKey...',
3808
3808
  * bridgeableTokenService,