wative-core 2.5.7 → 2.5.9

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 (36) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +6 -1
  3. package/dist/artifacts/evm/index.cjs +1 -1
  4. package/dist/artifacts/evm/index.d.cts +2 -2
  5. package/dist/artifacts/evm/index.d.ts +2 -2
  6. package/dist/artifacts/evm/index.js +1 -1
  7. package/dist/artifacts/svm/index.cjs +1 -1
  8. package/dist/artifacts/svm/index.d.cts +3 -3
  9. package/dist/artifacts/svm/index.d.ts +3 -3
  10. package/dist/artifacts/svm/index.js +1 -1
  11. package/dist/{container-provider-sRxvigzk.d.cts → container-provider-BECY3xFW.d.cts} +1 -1
  12. package/dist/{container-provider-CqpIaus8.d.ts → container-provider-Da9jn2NY.d.ts} +1 -1
  13. package/dist/{evm-KpZ3cLDe.d.ts → evm-B3-ujBFb.d.ts} +1 -1
  14. package/dist/{evm-hYUvjm9n.d.cts → evm-kJ59A16B.d.cts} +1 -1
  15. package/dist/{file-sink-B94nIe1u.d.cts → file-sink-5QWuUJGt.d.cts} +2 -2
  16. package/dist/{file-sink-Di2hJA5x.d.ts → file-sink-DemUj44c.d.ts} +2 -2
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +7 -7
  19. package/dist/index.d.ts +7 -7
  20. package/dist/index.js +1 -1
  21. package/dist/index.node.cjs +1 -1
  22. package/dist/index.node.d.cts +5 -5
  23. package/dist/index.node.d.ts +5 -5
  24. package/dist/index.node.js +1 -1
  25. package/dist/node/index.cjs +1 -1
  26. package/dist/node/index.d.cts +3 -3
  27. package/dist/node/index.d.ts +3 -3
  28. package/dist/node/index.js +1 -1
  29. package/dist/{svm-DYpcdzPR.d.ts → svm-DnKdq2PX.d.ts} +1 -1
  30. package/dist/{svm-B88JqNxb.d.cts → svm-uk1mRC3m.d.cts} +1 -1
  31. package/dist/{workspace-g-1DGOHJ.d.cts → workspace-BoiTRV1J.d.cts} +16 -8
  32. package/dist/{workspace-g-1DGOHJ.d.ts → workspace-BoiTRV1J.d.ts} +16 -8
  33. package/examples/04-network-management.test.cjs +3 -0
  34. package/examples/05-asset-management.test.cjs +2 -0
  35. package/examples/21-token-transfer.test.cjs +13 -0
  36. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { c as Address, a8 as SvmTxBuildParams, a7 as SvmTransaction, N as Network, a5 as SvmAddressLookupTable } from './workspace-g-1DGOHJ.js';
1
+ import { c as Address, a8 as SvmTxBuildParams, a7 as SvmTransaction, N as Network, a5 as SvmAddressLookupTable } from './workspace-BoiTRV1J.js';
2
2
 
3
3
  declare function svmResolveAddressLookupTables(network: Network, addresses: readonly string[]): Promise<SvmAddressLookupTable[]>;
4
4
  interface SvmInstruction {
@@ -1,4 +1,4 @@
1
- import { c as Address, a8 as SvmTxBuildParams, a7 as SvmTransaction, N as Network, a5 as SvmAddressLookupTable } from './workspace-g-1DGOHJ.cjs';
1
+ import { c as Address, a8 as SvmTxBuildParams, a7 as SvmTransaction, N as Network, a5 as SvmAddressLookupTable } from './workspace-BoiTRV1J.cjs';
2
2
 
3
3
  declare function svmResolveAddressLookupTables(network: Network, addresses: readonly string[]): Promise<SvmAddressLookupTable[]>;
4
4
  interface SvmInstruction {
@@ -39,6 +39,8 @@ declare class Asset {
39
39
  constructor(init: AssetInitObject);
40
40
  constructor(id: AssetId, symbol: string, name: string, decimals: number, network: Network, contractAddress?: string | null);
41
41
 
42
+ get isBuiltin(): boolean;
43
+
42
44
  save(): Promise<Asset>;
43
45
  }
44
46
  interface AssetBalance {
@@ -121,6 +123,10 @@ declare class Network {
121
123
 
122
124
  get symbol(): string;
123
125
 
126
+ get defaultRpcUrl(): string;
127
+
128
+ get isBuiltin(): boolean;
129
+
124
130
  get assets(): NetworkAssetCollection;
125
131
 
126
132
  save(): Promise<void>;
@@ -169,10 +175,9 @@ type Brand<T, B extends string> = T & {
169
175
  type Slug = Brand<string, "Slug">;
170
176
  type EvmAddress = Brand<string, "EvmAddress">;
171
177
  type SvmAddress = Brand<string, "SvmAddress">;
172
- type SuiAddress = Brand<string, "SuiAddress">;
173
178
  type ChainId = Brand<number, "ChainId">;
174
179
  type AssetId = Brand<number, "AssetId">;
175
- type ChainVM = "evm" | "svm" | "sui";
180
+ type ChainVM = "evm" | "svm";
176
181
  type VmToken = ChainVM | (string & {});
177
182
 
178
183
  type NetworkLike = Network | ChainId | string;
@@ -678,7 +683,7 @@ declare class SvmTransaction implements Transaction {
678
683
  }
679
684
 
680
685
  interface AddressInit {
681
- publicKey: EvmAddress | SvmAddress | SuiAddress;
686
+ publicKey: EvmAddress | SvmAddress;
682
687
  vm: VmToken;
683
688
  network: Network;
684
689
  ciphertext: string;
@@ -722,7 +727,7 @@ interface SignRawOptions {
722
727
  }
723
728
  declare class Address {
724
729
  #private;
725
- readonly publicKey: EvmAddress | SvmAddress | SuiAddress;
730
+ readonly publicKey: EvmAddress | SvmAddress;
726
731
  readonly vm: VmToken;
727
732
  readonly network: Network;
728
733
  readonly assets: AssetCollection;
@@ -782,8 +787,6 @@ declare class Address {
782
787
  rpcUrl?: string;
783
788
  }): Promise<SimulationResult>;
784
789
  refreshBalances(displayedOnly?: boolean): Settling<readonly AssetBalance[]>;
785
- refreshBalances(network: NetworkLike, displayedOnly?: boolean): Settling<readonly AssetBalance[]>;
786
- refreshBalances(assetId: AssetId): Settling<AssetBalance>;
787
790
  readonly _wallet: Wallet;
788
791
  }
789
792
  declare class EvmSigner extends Address {
@@ -811,7 +814,10 @@ declare class Wallet {
811
814
  _setAddresses(addresses: Address[]): void;
812
815
  get evm(): EvmSigner | null;
813
816
  get svm(): SvmSigner | null;
814
- get sui(): Address | null;
817
+
818
+ get vm(): VmToken;
819
+
820
+ get address(): Address | null;
815
821
 
816
822
  toJson(): ReadonlyArray<{
817
823
  vm: VmToken;
@@ -950,6 +956,8 @@ declare class Account {
950
956
 
951
957
  _enqueueMutation<T>(fn: () => Promise<T>): Promise<T>;
952
958
 
959
+ _resolveNetworkForVm(vm: VmToken, explicit?: NetworkLike): Network;
960
+
953
961
  _restoreUnlockPassword(pwd: string | null): void;
954
962
 
955
963
  _isDisabledSlot(index: number): boolean;
@@ -1123,4 +1131,4 @@ declare class Workspace {
1123
1131
  }>;
1124
1132
  }
1125
1133
 
1126
- export { type SignInResult as $, Account as A, EvmTxType as B, type ChainId as C, type DecodedTx as D, type EvmAddress as E, type LogRecord as F, type LogSink as G, Logger as H, type LoggerConfig as I, type NetworkAssetCollection as J, type NetworkCollection as K, type LogLevel as L, type NetworkInit as M, Network as N, type NetworkLike as O, type NetworkRoutes as P, type NormalizedTx as Q, type OpenOptions as R, Provider as S, type RawTx as T, Record$1 as U, type RecordInit as V, type RecordType as W, type SendOptions as X, type SendRoute as Y, type Settling as Z, type SignInParams as _, type AccountCollection as a, type SignRawOptions as a0, type SimulationResult as a1, type SinkConfig as a2, type Slug as a3, type SvmAddress as a4, type SvmAddressLookupTable as a5, SvmSigner as a6, SvmTransaction as a7, type SvmTxBuildParams as a8, type Transaction as a9, type TransactionReceipt as aa, type TransactionStateChange as ab, type TransactionStatus as ac, type TransactionTracker as ad, type TransferPayload as ae, type TransferRequest as af, type VmToken as ag, Wallet as ah, type WalletCollection as ai, WativeError as aj, type WativeErrorCode as ak, type WativeErrorOpts as al, Workspace as am, type WorkspaceConfig as an, deserializeEvmTx as ao, deserializeSvmTx as ap, deserializeTx as aq, isRawTx as ar, newMnemonic as as, normalizeTxInput as at, type SuiAddress as au, type AccountOrgType as b, Address as c, Asset as d, type AssetAddInit as e, type AssetBalance as f, type AssetCollection as g, type AssetId as h, type AssetInitObject as i, type AssetRef as j, type AssetUpdate as k, type ChainVM as l, type Commitment as m, ConsoleSink as n, type ContainerState as o, type DestinationCode as p, type DestinationGuardOptions as q, type DestinationReport as r, type DestinationScreenResult as s, type DestinationScreener as t, type DestinationSeverity as u, type DestinationWarning as v, type EvmRawTx as w, EvmSigner as x, EvmTransaction as y, type EvmTxBuildParams as z };
1134
+ export { type SignInResult as $, Account as A, EvmTxType as B, type ChainId as C, type DecodedTx as D, type EvmAddress as E, type LogRecord as F, type LogSink as G, Logger as H, type LoggerConfig as I, type NetworkAssetCollection as J, type NetworkCollection as K, type LogLevel as L, type NetworkInit as M, Network as N, type NetworkLike as O, type NetworkRoutes as P, type NormalizedTx as Q, type OpenOptions as R, Provider as S, type RawTx as T, Record$1 as U, type RecordInit as V, type RecordType as W, type SendOptions as X, type SendRoute as Y, type Settling as Z, type SignInParams as _, type AccountCollection as a, type SignRawOptions as a0, type SimulationResult as a1, type SinkConfig as a2, type Slug as a3, type SvmAddress as a4, type SvmAddressLookupTable as a5, SvmSigner as a6, SvmTransaction as a7, type SvmTxBuildParams as a8, type Transaction as a9, type TransactionReceipt as aa, type TransactionStateChange as ab, type TransactionStatus as ac, type TransactionTracker as ad, type TransferPayload as ae, type TransferRequest as af, type VmToken as ag, Wallet as ah, type WalletCollection as ai, WativeError as aj, type WativeErrorCode as ak, type WativeErrorOpts as al, Workspace as am, type WorkspaceConfig as an, deserializeEvmTx as ao, deserializeSvmTx as ap, deserializeTx as aq, isRawTx as ar, newMnemonic as as, normalizeTxInput as at, type AccountOrgType as b, Address as c, Asset as d, type AssetAddInit as e, type AssetBalance as f, type AssetCollection as g, type AssetId as h, type AssetInitObject as i, type AssetRef as j, type AssetUpdate as k, type ChainVM as l, type Commitment as m, ConsoleSink as n, type ContainerState as o, type DestinationCode as p, type DestinationGuardOptions as q, type DestinationReport as r, type DestinationScreenResult as s, type DestinationScreener as t, type DestinationSeverity as u, type DestinationWarning as v, type EvmRawTx as w, EvmSigner as x, EvmTransaction as y, type EvmTxBuildParams as z };
@@ -39,6 +39,8 @@ declare class Asset {
39
39
  constructor(init: AssetInitObject);
40
40
  constructor(id: AssetId, symbol: string, name: string, decimals: number, network: Network, contractAddress?: string | null);
41
41
 
42
+ get isBuiltin(): boolean;
43
+
42
44
  save(): Promise<Asset>;
43
45
  }
44
46
  interface AssetBalance {
@@ -121,6 +123,10 @@ declare class Network {
121
123
 
122
124
  get symbol(): string;
123
125
 
126
+ get defaultRpcUrl(): string;
127
+
128
+ get isBuiltin(): boolean;
129
+
124
130
  get assets(): NetworkAssetCollection;
125
131
 
126
132
  save(): Promise<void>;
@@ -169,10 +175,9 @@ type Brand<T, B extends string> = T & {
169
175
  type Slug = Brand<string, "Slug">;
170
176
  type EvmAddress = Brand<string, "EvmAddress">;
171
177
  type SvmAddress = Brand<string, "SvmAddress">;
172
- type SuiAddress = Brand<string, "SuiAddress">;
173
178
  type ChainId = Brand<number, "ChainId">;
174
179
  type AssetId = Brand<number, "AssetId">;
175
- type ChainVM = "evm" | "svm" | "sui";
180
+ type ChainVM = "evm" | "svm";
176
181
  type VmToken = ChainVM | (string & {});
177
182
 
178
183
  type NetworkLike = Network | ChainId | string;
@@ -678,7 +683,7 @@ declare class SvmTransaction implements Transaction {
678
683
  }
679
684
 
680
685
  interface AddressInit {
681
- publicKey: EvmAddress | SvmAddress | SuiAddress;
686
+ publicKey: EvmAddress | SvmAddress;
682
687
  vm: VmToken;
683
688
  network: Network;
684
689
  ciphertext: string;
@@ -722,7 +727,7 @@ interface SignRawOptions {
722
727
  }
723
728
  declare class Address {
724
729
  #private;
725
- readonly publicKey: EvmAddress | SvmAddress | SuiAddress;
730
+ readonly publicKey: EvmAddress | SvmAddress;
726
731
  readonly vm: VmToken;
727
732
  readonly network: Network;
728
733
  readonly assets: AssetCollection;
@@ -782,8 +787,6 @@ declare class Address {
782
787
  rpcUrl?: string;
783
788
  }): Promise<SimulationResult>;
784
789
  refreshBalances(displayedOnly?: boolean): Settling<readonly AssetBalance[]>;
785
- refreshBalances(network: NetworkLike, displayedOnly?: boolean): Settling<readonly AssetBalance[]>;
786
- refreshBalances(assetId: AssetId): Settling<AssetBalance>;
787
790
  readonly _wallet: Wallet;
788
791
  }
789
792
  declare class EvmSigner extends Address {
@@ -811,7 +814,10 @@ declare class Wallet {
811
814
  _setAddresses(addresses: Address[]): void;
812
815
  get evm(): EvmSigner | null;
813
816
  get svm(): SvmSigner | null;
814
- get sui(): Address | null;
817
+
818
+ get vm(): VmToken;
819
+
820
+ get address(): Address | null;
815
821
 
816
822
  toJson(): ReadonlyArray<{
817
823
  vm: VmToken;
@@ -950,6 +956,8 @@ declare class Account {
950
956
 
951
957
  _enqueueMutation<T>(fn: () => Promise<T>): Promise<T>;
952
958
 
959
+ _resolveNetworkForVm(vm: VmToken, explicit?: NetworkLike): Network;
960
+
953
961
  _restoreUnlockPassword(pwd: string | null): void;
954
962
 
955
963
  _isDisabledSlot(index: number): boolean;
@@ -1123,4 +1131,4 @@ declare class Workspace {
1123
1131
  }>;
1124
1132
  }
1125
1133
 
1126
- export { type SignInResult as $, Account as A, EvmTxType as B, type ChainId as C, type DecodedTx as D, type EvmAddress as E, type LogRecord as F, type LogSink as G, Logger as H, type LoggerConfig as I, type NetworkAssetCollection as J, type NetworkCollection as K, type LogLevel as L, type NetworkInit as M, Network as N, type NetworkLike as O, type NetworkRoutes as P, type NormalizedTx as Q, type OpenOptions as R, Provider as S, type RawTx as T, Record$1 as U, type RecordInit as V, type RecordType as W, type SendOptions as X, type SendRoute as Y, type Settling as Z, type SignInParams as _, type AccountCollection as a, type SignRawOptions as a0, type SimulationResult as a1, type SinkConfig as a2, type Slug as a3, type SvmAddress as a4, type SvmAddressLookupTable as a5, SvmSigner as a6, SvmTransaction as a7, type SvmTxBuildParams as a8, type Transaction as a9, type TransactionReceipt as aa, type TransactionStateChange as ab, type TransactionStatus as ac, type TransactionTracker as ad, type TransferPayload as ae, type TransferRequest as af, type VmToken as ag, Wallet as ah, type WalletCollection as ai, WativeError as aj, type WativeErrorCode as ak, type WativeErrorOpts as al, Workspace as am, type WorkspaceConfig as an, deserializeEvmTx as ao, deserializeSvmTx as ap, deserializeTx as aq, isRawTx as ar, newMnemonic as as, normalizeTxInput as at, type SuiAddress as au, type AccountOrgType as b, Address as c, Asset as d, type AssetAddInit as e, type AssetBalance as f, type AssetCollection as g, type AssetId as h, type AssetInitObject as i, type AssetRef as j, type AssetUpdate as k, type ChainVM as l, type Commitment as m, ConsoleSink as n, type ContainerState as o, type DestinationCode as p, type DestinationGuardOptions as q, type DestinationReport as r, type DestinationScreenResult as s, type DestinationScreener as t, type DestinationSeverity as u, type DestinationWarning as v, type EvmRawTx as w, EvmSigner as x, EvmTransaction as y, type EvmTxBuildParams as z };
1134
+ export { type SignInResult as $, Account as A, EvmTxType as B, type ChainId as C, type DecodedTx as D, type EvmAddress as E, type LogRecord as F, type LogSink as G, Logger as H, type LoggerConfig as I, type NetworkAssetCollection as J, type NetworkCollection as K, type LogLevel as L, type NetworkInit as M, Network as N, type NetworkLike as O, type NetworkRoutes as P, type NormalizedTx as Q, type OpenOptions as R, Provider as S, type RawTx as T, Record$1 as U, type RecordInit as V, type RecordType as W, type SendOptions as X, type SendRoute as Y, type Settling as Z, type SignInParams as _, type AccountCollection as a, type SignRawOptions as a0, type SimulationResult as a1, type SinkConfig as a2, type Slug as a3, type SvmAddress as a4, type SvmAddressLookupTable as a5, SvmSigner as a6, SvmTransaction as a7, type SvmTxBuildParams as a8, type Transaction as a9, type TransactionReceipt as aa, type TransactionStateChange as ab, type TransactionStatus as ac, type TransactionTracker as ad, type TransferPayload as ae, type TransferRequest as af, type VmToken as ag, Wallet as ah, type WalletCollection as ai, WativeError as aj, type WativeErrorCode as ak, type WativeErrorOpts as al, Workspace as am, type WorkspaceConfig as an, deserializeEvmTx as ao, deserializeSvmTx as ap, deserializeTx as aq, isRawTx as ar, newMnemonic as as, normalizeTxInput as at, type AccountOrgType as b, Address as c, Asset as d, type AssetAddInit as e, type AssetBalance as f, type AssetCollection as g, type AssetId as h, type AssetInitObject as i, type AssetRef as j, type AssetUpdate as k, type ChainVM as l, type Commitment as m, ConsoleSink as n, type ContainerState as o, type DestinationCode as p, type DestinationGuardOptions as q, type DestinationReport as r, type DestinationScreenResult as s, type DestinationScreener as t, type DestinationSeverity as u, type DestinationWarning as v, type EvmRawTx as w, EvmSigner as x, EvmTransaction as y, type EvmTxBuildParams as z };
@@ -84,6 +84,9 @@ test("network — drop user network; pre-loaded networks reject drop", async ()
84
84
  });
85
85
  await ws.networks.add(custom);
86
86
 
87
+ assert.strictEqual(custom.isBuiltin, false);
88
+ assert.strictEqual(ws.networks.bySlug("ethereum").isBuiltin, true);
89
+
87
90
  await ws.networks.drop(custom);
88
91
  assert.strictEqual(ws.networks.bySlug("my-net"), null);
89
92
 
@@ -144,7 +144,9 @@ test("asset — two-tier edits: a user token edits all metadata, a built-in only
144
144
  assert.strictEqual(updated.decimals, 8);
145
145
  assert.strictEqual(updated.displayStatus, false);
146
146
 
147
+ assert.strictEqual(mine.isBuiltin, false);
147
148
  const usdc = eth.assets.find((a) => a.symbol === "USDC");
149
+ assert.strictEqual(usdc.isBuiltin, true);
148
150
  const builtinEdited = await ws.updateAsset(usdc.id, { displayStatus: false });
149
151
  assert.strictEqual(builtinEdited.displayStatus, false);
150
152
  await assert.rejects(ws.updateAsset(usdc.id, { symbol: "USDX" }), (err) => err.code === "PARAMETER_ERROR");
@@ -59,6 +59,19 @@ test("buildTransferPayload() —SVM SPL by mint prepends an idempotent recipient
59
59
  await ws.lock();
60
60
  });
61
61
 
62
+ test("buildTransaction({ tokenMint }) —low-level SPL transfer convenience (SVM)", async () => {
63
+ const { ws, w0, w1 } = await twoWallets();
64
+ const tx = w0.svm.buildTransaction({
65
+ recipient: String(w1.svm.publicKey),
66
+ amount: 1_000_000n,
67
+ tokenMint: USDC_SVM_MINT,
68
+ recentBlockhash: "11111111111111111111111111111111",
69
+ });
70
+ assert.ok(tx);
71
+
72
+ await ws.lock();
73
+ });
74
+
62
75
  test("buildTransferPayload() —by token symbol resolves to native vs token", async () => {
63
76
  const { ws, w0, w1 } = await twoWallets();
64
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wative-core",
3
- "version": "2.5.7",
3
+ "version": "2.5.9",
4
4
  "description": "Hyperscale crypto wallet management library — multi-workspace, multi-chain, originally designed for on-chain market makers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.node.cjs",