Skip to content

Commit ad37166

Browse files
committed
Update @nimiq/albatross-wasm package to latest rc.4
1 parent ea619ef commit ad37166

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

src/demo/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ window.addEventListener('load', () => {
916916
senderType,
917917
recipient,
918918
recipientType,
919-
value: amount,
920-
fee,
919+
value: BigInt(amount),
920+
fee: BigInt(fee),
921921
validityStartHeight,
922922
flags,
923923
network,

src/high-level-api/requests/nimiq/request-sign-message-nimiq.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default class RequestSignMessageNimiq<Version extends NimiqVersion>
7373

7474
return {
7575
signer: new Nimiq.PublicKey(publicKey),
76-
signature: isNimiqLegacy(Nimiq) ? new Nimiq.Signature(signature) : Nimiq.Signature.fromBytes(signature),
76+
signature: isNimiqLegacy(Nimiq) ? new Nimiq.Signature(signature) : Nimiq.Signature.deserialize(signature),
7777
} as MessageSignatureInfoNimiq<Version>;
7878
}
7979
}

src/high-level-api/requests/nimiq/request-sign-transaction-nimiq.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ type Transport = import('@ledgerhq/hw-transport').default;
99
export type TransactionInfoNimiq<Version extends NimiqVersion> = {
1010
sender: NimiqPrimitive<'Address', Version>,
1111
recipient: NimiqPrimitive<'Address', Version>,
12-
value: number, // In Luna
13-
fee?: number,
1412
validityStartHeight: number,
1513
network?: Network,
1614
flags?: number,
1715
} & (Version extends NimiqVersion.ALBATROSS ? {
16+
value: bigint, // In Luna
17+
fee?: bigint,
1818
senderType?: AccountTypeNimiq,
1919
senderData?: Uint8Array,
2020
recipientType?: AccountTypeNimiq,
2121
recipientData?: Uint8Array,
2222
} : {
23+
value: number, // In Luna
24+
fee?: number,
2325
senderType?: Exclude<AccountTypeNimiq, AccountTypeNimiq.STAKING>,
2426
recipientType?: Exclude<AccountTypeNimiq, AccountTypeNimiq.STAKING>,
2527
extraData?: Uint8Array,
@@ -119,20 +121,23 @@ export default class RequestSignTransactionNimiq<Version extends NimiqVersion>
119121
nimiqTx = new Nimiq.ExtendedTransaction(
120122
tx.sender, senderType as NonNullable<typeof tx.senderType>,
121123
tx.recipient, recipientType as NonNullable<typeof tx.recipientType>,
122-
tx.value, fee, tx.validityStartHeight, flags, extraData, /* proof */ undefined, networkId,
124+
tx.value, Number(fee), tx.validityStartHeight, flags, extraData,
125+
/* proof */ undefined, networkId,
123126
);
124127
} else {
125128
const signerPubKey = new Nimiq.PublicKey(signerPubKeyBytes);
126129
nimiqTx = new Nimiq.BasicTransaction(
127130
signerPubKey, tx.recipient,
128-
tx.value, fee, tx.validityStartHeight, /* signature */ undefined, networkId,
131+
tx.value, Number(fee), tx.validityStartHeight,
132+
/* signature */ undefined, networkId,
129133
);
130134
}
131135
} else if (!isNimiqLegacy(Nimiq) && !isTransactionInfoNimiqLegacy(tx)) {
132136
nimiqTx = new Nimiq.Transaction(
133137
tx.sender, senderType, tx.senderData,
134138
tx.recipient, recipientType, tx.recipientData,
135-
BigInt(tx.value), BigInt(fee), tx.flags, tx.validityStartHeight, networkId,
139+
tx.value, BigInt(fee), tx.flags,
140+
tx.validityStartHeight, networkId,
136141
);
137142
} else {
138143
throw new Error('Invalid transactionInfo');
@@ -169,14 +174,14 @@ export default class RequestSignTransactionNimiq<Version extends NimiqVersion>
169174
}
170175
} else {
171176
const signerPubKey = new Nimiq.PublicKey(signerPubKeyBytes);
172-
const signature = Nimiq.Signature.fromBytes(signatureBytes);
177+
const signature = Nimiq.Signature.deserialize(signatureBytes);
173178
nimiqTx.proof = Nimiq.SignatureProof.singleSig(signerPubKey, signature).serialize();
174179
if (stakerSignatureBytes) {
175180
// The Ledger app created a staker signature, which means it's a staking transaction with a staker
176181
// signature proof in its recipient data but for which the empty default signature proof was passed,
177182
// such that the Ledger created the staker signature with the same private key as staker private key
178183
// as the transaction sender key.
179-
const stakerSignature = Nimiq.Signature.fromBytes(stakerSignatureBytes);
184+
const stakerSignature = Nimiq.Signature.deserialize(stakerSignatureBytes);
180185
const stakerSignatureProof = Nimiq.SignatureProof.singleSig(signerPubKey, stakerSignature);
181186
// Overwrite the empty default signature proof in the staking transaction's recipient data. The
182187
// signature proof is always at the very end of the recipient data, for recipient data which include

src/low-level-api/low-level-api-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function verifySignature(
5353
const nimiqPublicKey = new Nimiq.PublicKey(publicKey);
5454
return nimiqSignature.verify(nimiqPublicKey, data);
5555
} else {
56-
const nimiqSignature = Nimiq.Signature.fromBytes(signature);
56+
const nimiqSignature = Nimiq.Signature.deserialize(signature);
5757
const nimiqPublicKey = new Nimiq.PublicKey(publicKey);
5858
return nimiqPublicKey.verify(nimiqSignature, data);
5959
}

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@
213213
integrity sha512-HHK9y4GGe4X7CXbRUCh7z8Mp+WggpJn1dmUjmuk1rNugESF6o8nAOnXA+BxwtRRNV3CgNJR3Wxdos4J9qV0Zsg==
214214

215215
"@nimiq/albatross-wasm@npm:@nimiq/core@next":
216-
version "2.0.0-next.rc.0"
217-
resolved "https://registry.yarnpkg.com/@nimiq/core/-/core-2.0.0-next.rc.0.tgz#402dbbf4bf40a815e4c2a323df7ebe253be18063"
218-
integrity sha512-mExuJIO9VIuH/MO/Od0o357hcUQ5hxdRzReTieGP1XO7tD/X+saHDsCWfCM+SowWyrbqzOBtEDzWmRpAktQzzg==
216+
version "2.0.0-next.rc.4"
217+
resolved "https://registry.yarnpkg.com/@nimiq/core/-/core-2.0.0-next.rc.4.tgz#a353f4507f2f10e3be741f920cff921c9474dea7"
218+
integrity sha512-qSBy/Mg0rbqAstEnrgzGhqeQpmQdOjCZPWmBV5uFxAMAAYl9nrABaXWQXo3Jvemvx5VQE9pz5/ma3I8Z0ROy1g==
219219
dependencies:
220220
comlink "^4.4.1"
221221
websocket "^1.0.34"

0 commit comments

Comments
 (0)