wative-core 2.5.1 → 2.5.2
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/CHANGELOG.md +9 -0
- package/README.md +27 -3
- package/dist/artifacts/evm/index.cjs +1 -1
- package/dist/artifacts/evm/index.d.cts +2 -2
- package/dist/artifacts/evm/index.d.ts +2 -2
- package/dist/artifacts/evm/index.js +1 -1
- package/dist/artifacts/svm/index.cjs +1 -1
- package/dist/artifacts/svm/index.d.cts +3 -3
- package/dist/artifacts/svm/index.d.ts +3 -3
- package/dist/artifacts/svm/index.js +1 -1
- package/dist/{container-provider-CBBJbpUn.d.ts → container-provider-CH6Xg37M.d.ts} +1 -1
- package/dist/{container-provider-COvXmCLM.d.cts → container-provider-CwaWx7dP.d.cts} +1 -1
- package/dist/{evm-V5Fn53uW.d.cts → evm-CNVThs9s.d.cts} +1 -1
- package/dist/{evm-Dk4ceFz0.d.ts → evm-YfBR8PgX.d.ts} +1 -1
- package/dist/{file-sink-Bf9mpegF.d.ts → file-sink-C0gUIm1T.d.ts} +2 -2
- package/dist/{file-sink-BjbtAHUL.d.cts → file-sink-WkxXiVRr.d.cts} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/index.node.cjs +1 -1
- package/dist/index.node.d.cts +5 -5
- package/dist/index.node.d.ts +5 -5
- package/dist/index.node.js +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +1 -1
- package/dist/{svm-D8zsWS64.d.ts → svm-CK_DQNIq.d.ts} +1 -1
- package/dist/{svm-CjNIJZ4l.d.cts → svm-DF7cHWms.d.cts} +1 -1
- package/dist/{workspace-DqUdScht.d.cts → workspace-CFDXsaHa.d.cts} +12 -0
- package/dist/{workspace-DqUdScht.d.ts → workspace-CFDXsaHa.d.ts} +12 -0
- package/examples/17-locked-state.test.cjs +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `wative-core` are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [2.5.2] — 2026-09-18
|
|
6
|
+
|
|
7
|
+
Adds two methods for signing bytes you built yourself.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `address.signDigest(digest)` signs a 32-byte digest on an EVM address exactly as given, with no hashing and no prefix. It returns `r`, `s`, the recovery id (0 or 1), and a 65-byte `signature` with `v = 27 + recovery`. Build `v` from `recovery` for a typed or EIP-155 transaction.
|
|
11
|
+
- `address.signBytes(message)` signs arbitrary bytes on an SVM address exactly as given, for example a serialized Solana transaction message. It returns the 64-byte signature as base58 and as hex.
|
|
12
|
+
- Both take a `Uint8Array` or a `0x`-prefixed hex string of whole bytes, need the account unlocked, and sign whatever they are given, so pass only data you assembled yourself.
|
|
13
|
+
|
|
5
14
|
## [2.5.1] — 2026-09-12
|
|
6
15
|
|
|
7
16
|
Renames the transfer helper and improves fee handling.
|
package/README.md
CHANGED
|
@@ -477,7 +477,7 @@ const tx = evmAddr.buildTransaction({
|
|
|
477
477
|
value: 1_000_000_000_000_000n,
|
|
478
478
|
chainId: 1,
|
|
479
479
|
});
|
|
480
|
-
await
|
|
480
|
+
await tx.sign(); // resolves once the signature exists
|
|
481
481
|
const tracker = await evmAddr.sendTransaction(tx);
|
|
482
482
|
|
|
483
483
|
tracker.on("change", (state) => console.log("state →", state.status));
|
|
@@ -491,6 +491,8 @@ const sim = await evmAddr.simulateTransaction(tx);
|
|
|
491
491
|
console.log(sim.gasUsed);
|
|
492
492
|
```
|
|
493
493
|
|
|
494
|
+
`address.signTransaction(tx)` returns straight away and does not wait for the signature. To use the signed bytes (`tx.rawTransaction`, `tx.hash`), `await tx.sign()` first — it resolves once signing is done and is safe to call more than once.
|
|
495
|
+
|
|
494
496
|
`buildTransferPayload()` is the one-call path for moving value — it works out the right payload for the asset (native value, ERC-20 calldata, or SPL instructions). You then pass that payload to `buildTransaction()` and send it like any other transaction:
|
|
495
497
|
|
|
496
498
|
```ts
|
|
@@ -503,11 +505,32 @@ const bySymbol = evmAddr.buildTransferPayload({ to: recipient, asset: { symbol:
|
|
|
503
505
|
|
|
504
506
|
// build the transaction from the payload, then sign/send it
|
|
505
507
|
const tx = evmAddr.buildTransaction({ ...nativePayload, chainId: 1 });
|
|
506
|
-
await
|
|
508
|
+
await tx.sign();
|
|
507
509
|
```
|
|
508
510
|
|
|
509
511
|
Amounts are in the token's smallest unit. `buildTransaction` fills in nonce/gas/fees for you when you omit them, or uses the values you pass. An SPL transfer to a recipient without a token account prepends the account-creation step for you.
|
|
510
512
|
|
|
513
|
+
#### Signing bytes you built yourself
|
|
514
|
+
|
|
515
|
+
If you build and broadcast transactions yourself and only need a signature, two methods sign exactly the bytes you give them. Neither hashes its input, adds a prefix, or touches the network.
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
// EVM: sign a 32-byte digest you computed (for example the keccak of an encoded transaction)
|
|
519
|
+
const { r, s, recovery, signature } = evmAddr.signDigest("0x" + "ab".repeat(32));
|
|
520
|
+
// r, s: 32-byte hex (s is low); recovery: 0 or 1; signature: 65 bytes, v = 27 + recovery
|
|
521
|
+
|
|
522
|
+
// SVM: sign arbitrary bytes, for example a serialized Solana transaction message
|
|
523
|
+
const { signature: sig58, signatureHex } = svmAddr.signBytes(messageBytes);
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
- Both take a `Uint8Array` or a `0x`-prefixed hex string of whole bytes. Base64 and hex without the prefix are refused; decode base64 yourself first.
|
|
527
|
+
- `signDigest` requires exactly 32 bytes.
|
|
528
|
+
- `signBytes` accepts any length, including binary data that `signMessageEncoded(..., "ed25519")` cannot carry, because that method takes text.
|
|
529
|
+
- The 65-byte `signature` uses the message-signing convention for `v`. For a typed transaction use `recovery` as the y-parity, and for a legacy EIP-155 transaction use `35 + 2 * chainId + recovery`.
|
|
530
|
+
- `signDigest` works only on an EVM address and `signBytes` only on an SVM address. Each needs the account unlocked.
|
|
531
|
+
|
|
532
|
+
> ⚠️ These sign anything you hand them, with none of the checks `signTypedData` applies. Only pass digests and bytes you assembled yourself.
|
|
533
|
+
|
|
511
534
|
### Network — pre-loaded networks + your own
|
|
512
535
|
|
|
513
536
|
```ts
|
|
@@ -581,7 +604,8 @@ const evmTx = new EvmTransaction({
|
|
|
581
604
|
maxFeePerGas: 50_000_000_000n,
|
|
582
605
|
maxPriorityFeePerGas: 1_000_000_000n,
|
|
583
606
|
});
|
|
584
|
-
|
|
607
|
+
evmAddr.signTransaction(evmTx); // checks `from` and attaches the transaction to this address
|
|
608
|
+
await evmTx.sign(); // resolves once the signature exists
|
|
585
609
|
const evmTracker = await evmAddr.sendTransaction(evmTx);
|
|
586
610
|
|
|
587
611
|
const receipt = await evmTracker.whenConfirmed();
|