wative-core 2.4.6 → 2.5.0

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 (38) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +47 -5
  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-CCBOKuHv.d.cts → container-provider-BCG7wTYx.d.cts} +1 -1
  12. package/dist/{container-provider-COf_p1JR.d.ts → container-provider-DMZGR5MP.d.ts} +1 -1
  13. package/dist/{evm-B5b_UPYy.d.ts → evm-BZoe2IFx.d.ts} +1 -1
  14. package/dist/{evm-BMB0sT3U.d.cts → evm-BeI4m7M5.d.cts} +1 -1
  15. package/dist/{file-sink-778TcqKz.d.cts → file-sink-BLqWAqHB.d.cts} +2 -2
  16. package/dist/{file-sink-Bu1YeJSR.d.ts → file-sink-CuPr45EN.d.ts} +2 -2
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +55 -7
  19. package/dist/index.d.ts +55 -7
  20. package/dist/index.js +1 -1
  21. package/dist/index.node.cjs +1 -1
  22. package/dist/index.node.d.cts +6 -6
  23. package/dist/index.node.d.ts +6 -6
  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-CZ-D916M.d.ts → svm-BQMaUXEA.d.ts} +1 -1
  30. package/dist/{svm-BRKxogvC.d.cts → svm-Bi74PhrA.d.cts} +1 -1
  31. package/dist/{workspace-Clmfomrc.d.cts → workspace-ZNpsa6W7.d.cts} +36 -11
  32. package/dist/{workspace-Clmfomrc.d.ts → workspace-ZNpsa6W7.d.ts} +36 -11
  33. package/examples/04-network-management.test.cjs +5 -4
  34. package/examples/07-custom-provider.test.cjs +1 -1
  35. package/examples/20-custom-chain-dialect.test.cjs +155 -0
  36. package/examples/21-token-transfer.test.cjs +85 -0
  37. package/examples/README.md +5 -2
  38. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { P as Provider, x as RecordType, B as Slug, R as Record$1, i as ChainVM } from './workspace-Clmfomrc.cjs';
2
- export { A as Account, a as AccountCollection, b as AccountOrgType, c as Address, d as Asset, e as AssetBalance, f as AssetCollection, g as AssetId, h as AssetInitObject, C as ChainId, j as ConsoleSink, k as ContainerState, E as EvmAddress, l as EvmRawTx, m as EvmTransaction, n as EvmTxBuildParams, o as EvmTxType, L as LogLevel, p as LogRecord, q as LogSink, r as Logger, s as LoggerConfig, N as Network, t as NetworkCollection, u as NetworkInit, v as NetworkLike, O as OpenOptions, w as RecordInit, S as Settling, y as SimulationResult, z as SinkConfig, D as SvmAddress, F as SvmTransaction, G as SvmTxBuildParams, T as Transaction, H as TransactionReceipt, I as TransactionStateChange, J as TransactionStatus, K as TransactionTracker, W as Wallet, M as WalletCollection, Q as WativeError, U as WativeErrorCode, V as WativeErrorOpts, X as Workspace, Y as WorkspaceConfig, Z as newMnemonic } from './workspace-Clmfomrc.cjs';
3
- import { a as ContainerProvider } from './container-provider-CCBOKuHv.cjs';
4
- export { C as ContainerEntry } from './container-provider-CCBOKuHv.cjs';
5
- export { A as AbiItem, C as Contract } from './evm-BMB0sT3U.cjs';
6
- export { P as Program, S as SvmInstruction } from './svm-BRKxogvC.cjs';
1
+ import { P as Provider, z as RecordType, F as Slug, R as Record$1, E as EvmAddress, G as SvmAddress, a3 as SuiAddress, W as VmToken, N as Network, f as AssetCollection, p as EvmTxBuildParams, J as SvmTxBuildParams, T as Transaction, V as TransferRequest, j as ChainVM } from './workspace-ZNpsa6W7.cjs';
2
+ export { A as Account, a as AccountCollection, b as AccountOrgType, c as Address, d as Asset, e as AssetBalance, g as AssetId, h as AssetInitObject, i as AssetRef, C as ChainId, k as ConsoleSink, l as ContainerState, m as EvmRawTx, n as EvmSigner, o as EvmTransaction, q as EvmTxType, L as LogLevel, r as LogRecord, s as LogSink, t as Logger, u as LoggerConfig, v as NetworkCollection, w as NetworkInit, x as NetworkLike, O as OpenOptions, y as RecordInit, S as Settling, B as SimulationResult, D as SinkConfig, H as SvmSigner, I as SvmTransaction, K as TransactionReceipt, M as TransactionStateChange, Q as TransactionStatus, U as TransactionTracker, X as Wallet, Y as WalletCollection, Z as WativeError, _ as WativeErrorCode, $ as WativeErrorOpts, a0 as Workspace, a1 as WorkspaceConfig, a2 as newMnemonic } from './workspace-ZNpsa6W7.cjs';
3
+ import { a as ContainerProvider } from './container-provider-BCG7wTYx.cjs';
4
+ export { C as ContainerEntry } from './container-provider-BCG7wTYx.cjs';
5
+ export { A as AbiItem, C as Contract } from './evm-BeI4m7M5.cjs';
6
+ export { P as Program, S as SvmInstruction } from './svm-Bi74PhrA.cjs';
7
7
 
8
8
  type StorageDurability = "persistent" | "best-effort";
9
9
  interface IdbProviderOptions {
@@ -186,6 +186,54 @@ declare class PasswordPolicy {
186
186
 
187
187
  declare function closeAllRpcClients(): Promise<void>;
188
188
 
189
+ interface RecoveredSecpSig {
190
+ recovery: number;
191
+ toCompactHex(): string;
192
+ }
193
+ type CurveName = "secp256k1" | "ed25519";
194
+
195
+ type MessageEncoding = "personal_sign" | "raw" | "ed25519";
196
+
197
+ interface DigestSigner {
198
+ _signBytes(input: string | Uint8Array): RecoveredSecpSig | Uint8Array;
199
+ }
200
+
201
+ interface ChainCtx extends DigestSigner {
202
+ readonly publicKey: EvmAddress | SvmAddress | SuiAddress;
203
+ readonly vm: VmToken;
204
+ readonly network: Network;
205
+ readonly assets: AssetCollection;
206
+ }
207
+ declare abstract class ChainDialect {
208
+
209
+ abstract readonly vm: VmToken;
210
+
211
+ abstract readonly curve: CurveName;
212
+ abstract signMessage(ctx: ChainCtx, message: string): string;
213
+ abstract signMessageEncoded(ctx: ChainCtx, message: string, encoding: MessageEncoding): {
214
+ signature: string;
215
+ messageHash: string;
216
+ };
217
+ abstract signTypedData(ctx: ChainCtx, typedData: unknown, chainId: number | bigint): {
218
+ signature: string;
219
+ domainSeparator: string;
220
+ structHash: string;
221
+ };
222
+ abstract buildTransaction(ctx: ChainCtx, params: EvmTxBuildParams | SvmTxBuildParams): Transaction;
223
+ abstract transfer(ctx: ChainCtx, req: TransferRequest): Transaction;
224
+
225
+ abstract derive(seed: Uint8Array, index: number): {
226
+ publicKey: string;
227
+ privateKey: string;
228
+ };
229
+
230
+ abstract addressFromPrivateKey(privateKey: string): string;
231
+
232
+ abstract privateKeyMatches(privateKey: string, publicKey: string): boolean;
233
+ }
234
+
235
+ declare function registerDialect(vm: string, factory: () => ChainDialect): void;
236
+
189
237
  interface NetworkConfig {
190
238
  readonly slug: string;
191
239
  readonly name: string;
@@ -210,4 +258,4 @@ interface AssetInit {
210
258
  }
211
259
  declare const BUILTIN_ASSETS: Record<string, ReadonlyArray<AssetInit>>;
212
260
 
213
- export { AesGcmCipher, type AesGcmCipherOptions, type Argon2BackendInfo, Argon2Kdf, type Argon2KdfOptions, type AssetInit, BUILTIN_ASSETS, BUILTIN_NETWORKS, ChainVM, Cipher, ContainerProvider, DbProvider, FileProvider, type IdbDestroyOptions, IdbProvider, type IdbProviderOptions, type NetworkConfig, type PasswordCheckContext, type PasswordCheckResult, PasswordPolicy, type PasswordPolicyOptions, PasswordScore, type PasswordWeakness, type PasswordWeaknessCode, Provider, Record$1 as Record, RecordType, Slug, type StorageDurability, type StorageQuota, argon2BackendInfo, closeAllRpcClients };
261
+ export { AesGcmCipher, type AesGcmCipherOptions, type Argon2BackendInfo, Argon2Kdf, type Argon2KdfOptions, AssetCollection, type AssetInit, BUILTIN_ASSETS, BUILTIN_NETWORKS, type ChainCtx, ChainDialect, ChainVM, Cipher, ContainerProvider, type CurveName, DbProvider, type DigestSigner, EvmAddress, EvmTxBuildParams, FileProvider, type IdbDestroyOptions, IdbProvider, type IdbProviderOptions, type MessageEncoding, Network, type NetworkConfig, type PasswordCheckContext, type PasswordCheckResult, PasswordPolicy, type PasswordPolicyOptions, PasswordScore, type PasswordWeakness, type PasswordWeaknessCode, Provider, Record$1 as Record, RecordType, type RecoveredSecpSig, Slug, type StorageDurability, type StorageQuota, SvmAddress, SvmTxBuildParams, Transaction, TransferRequest, VmToken, argon2BackendInfo, closeAllRpcClients, registerDialect };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { P as Provider, x as RecordType, B as Slug, R as Record$1, i as ChainVM } from './workspace-Clmfomrc.js';
2
- export { A as Account, a as AccountCollection, b as AccountOrgType, c as Address, d as Asset, e as AssetBalance, f as AssetCollection, g as AssetId, h as AssetInitObject, C as ChainId, j as ConsoleSink, k as ContainerState, E as EvmAddress, l as EvmRawTx, m as EvmTransaction, n as EvmTxBuildParams, o as EvmTxType, L as LogLevel, p as LogRecord, q as LogSink, r as Logger, s as LoggerConfig, N as Network, t as NetworkCollection, u as NetworkInit, v as NetworkLike, O as OpenOptions, w as RecordInit, S as Settling, y as SimulationResult, z as SinkConfig, D as SvmAddress, F as SvmTransaction, G as SvmTxBuildParams, T as Transaction, H as TransactionReceipt, I as TransactionStateChange, J as TransactionStatus, K as TransactionTracker, W as Wallet, M as WalletCollection, Q as WativeError, U as WativeErrorCode, V as WativeErrorOpts, X as Workspace, Y as WorkspaceConfig, Z as newMnemonic } from './workspace-Clmfomrc.js';
3
- import { a as ContainerProvider } from './container-provider-COf_p1JR.js';
4
- export { C as ContainerEntry } from './container-provider-COf_p1JR.js';
5
- export { A as AbiItem, C as Contract } from './evm-B5b_UPYy.js';
6
- export { P as Program, S as SvmInstruction } from './svm-CZ-D916M.js';
1
+ import { P as Provider, z as RecordType, F as Slug, R as Record$1, E as EvmAddress, G as SvmAddress, a3 as SuiAddress, W as VmToken, N as Network, f as AssetCollection, p as EvmTxBuildParams, J as SvmTxBuildParams, T as Transaction, V as TransferRequest, j as ChainVM } from './workspace-ZNpsa6W7.js';
2
+ export { A as Account, a as AccountCollection, b as AccountOrgType, c as Address, d as Asset, e as AssetBalance, g as AssetId, h as AssetInitObject, i as AssetRef, C as ChainId, k as ConsoleSink, l as ContainerState, m as EvmRawTx, n as EvmSigner, o as EvmTransaction, q as EvmTxType, L as LogLevel, r as LogRecord, s as LogSink, t as Logger, u as LoggerConfig, v as NetworkCollection, w as NetworkInit, x as NetworkLike, O as OpenOptions, y as RecordInit, S as Settling, B as SimulationResult, D as SinkConfig, H as SvmSigner, I as SvmTransaction, K as TransactionReceipt, M as TransactionStateChange, Q as TransactionStatus, U as TransactionTracker, X as Wallet, Y as WalletCollection, Z as WativeError, _ as WativeErrorCode, $ as WativeErrorOpts, a0 as Workspace, a1 as WorkspaceConfig, a2 as newMnemonic } from './workspace-ZNpsa6W7.js';
3
+ import { a as ContainerProvider } from './container-provider-DMZGR5MP.js';
4
+ export { C as ContainerEntry } from './container-provider-DMZGR5MP.js';
5
+ export { A as AbiItem, C as Contract } from './evm-BZoe2IFx.js';
6
+ export { P as Program, S as SvmInstruction } from './svm-BQMaUXEA.js';
7
7
 
8
8
  type StorageDurability = "persistent" | "best-effort";
9
9
  interface IdbProviderOptions {
@@ -186,6 +186,54 @@ declare class PasswordPolicy {
186
186
 
187
187
  declare function closeAllRpcClients(): Promise<void>;
188
188
 
189
+ interface RecoveredSecpSig {
190
+ recovery: number;
191
+ toCompactHex(): string;
192
+ }
193
+ type CurveName = "secp256k1" | "ed25519";
194
+
195
+ type MessageEncoding = "personal_sign" | "raw" | "ed25519";
196
+
197
+ interface DigestSigner {
198
+ _signBytes(input: string | Uint8Array): RecoveredSecpSig | Uint8Array;
199
+ }
200
+
201
+ interface ChainCtx extends DigestSigner {
202
+ readonly publicKey: EvmAddress | SvmAddress | SuiAddress;
203
+ readonly vm: VmToken;
204
+ readonly network: Network;
205
+ readonly assets: AssetCollection;
206
+ }
207
+ declare abstract class ChainDialect {
208
+
209
+ abstract readonly vm: VmToken;
210
+
211
+ abstract readonly curve: CurveName;
212
+ abstract signMessage(ctx: ChainCtx, message: string): string;
213
+ abstract signMessageEncoded(ctx: ChainCtx, message: string, encoding: MessageEncoding): {
214
+ signature: string;
215
+ messageHash: string;
216
+ };
217
+ abstract signTypedData(ctx: ChainCtx, typedData: unknown, chainId: number | bigint): {
218
+ signature: string;
219
+ domainSeparator: string;
220
+ structHash: string;
221
+ };
222
+ abstract buildTransaction(ctx: ChainCtx, params: EvmTxBuildParams | SvmTxBuildParams): Transaction;
223
+ abstract transfer(ctx: ChainCtx, req: TransferRequest): Transaction;
224
+
225
+ abstract derive(seed: Uint8Array, index: number): {
226
+ publicKey: string;
227
+ privateKey: string;
228
+ };
229
+
230
+ abstract addressFromPrivateKey(privateKey: string): string;
231
+
232
+ abstract privateKeyMatches(privateKey: string, publicKey: string): boolean;
233
+ }
234
+
235
+ declare function registerDialect(vm: string, factory: () => ChainDialect): void;
236
+
189
237
  interface NetworkConfig {
190
238
  readonly slug: string;
191
239
  readonly name: string;
@@ -210,4 +258,4 @@ interface AssetInit {
210
258
  }
211
259
  declare const BUILTIN_ASSETS: Record<string, ReadonlyArray<AssetInit>>;
212
260
 
213
- export { AesGcmCipher, type AesGcmCipherOptions, type Argon2BackendInfo, Argon2Kdf, type Argon2KdfOptions, type AssetInit, BUILTIN_ASSETS, BUILTIN_NETWORKS, ChainVM, Cipher, ContainerProvider, DbProvider, FileProvider, type IdbDestroyOptions, IdbProvider, type IdbProviderOptions, type NetworkConfig, type PasswordCheckContext, type PasswordCheckResult, PasswordPolicy, type PasswordPolicyOptions, PasswordScore, type PasswordWeakness, type PasswordWeaknessCode, Provider, Record$1 as Record, RecordType, Slug, type StorageDurability, type StorageQuota, argon2BackendInfo, closeAllRpcClients };
261
+ export { AesGcmCipher, type AesGcmCipherOptions, type Argon2BackendInfo, Argon2Kdf, type Argon2KdfOptions, AssetCollection, type AssetInit, BUILTIN_ASSETS, BUILTIN_NETWORKS, type ChainCtx, ChainDialect, ChainVM, Cipher, ContainerProvider, type CurveName, DbProvider, type DigestSigner, EvmAddress, EvmTxBuildParams, FileProvider, type IdbDestroyOptions, IdbProvider, type IdbProviderOptions, type MessageEncoding, Network, type NetworkConfig, type PasswordCheckContext, type PasswordCheckResult, PasswordPolicy, type PasswordPolicyOptions, PasswordScore, type PasswordWeakness, type PasswordWeaknessCode, Provider, Record$1 as Record, RecordType, type RecoveredSecpSig, Slug, type StorageDurability, type StorageQuota, SvmAddress, SvmTxBuildParams, Transaction, TransferRequest, VmToken, argon2BackendInfo, closeAllRpcClients, registerDialect };