Skip to content

Commit

Permalink
Merge #2165
Browse files Browse the repository at this point in the history
2165: Minor sdk fixes r=popzxc a=perekopskiy



Co-authored-by: perekopskiy <[email protected]>
  • Loading branch information
bors-matterlabs-dev[bot] and perekopskiy authored Feb 10, 2022
2 parents 565e867 + fe8a269 commit 315d4d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sdk/zksync.js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zksync",
"version": "0.12.0-alpha.4",
"version": "0.12.0-alpha.5",
"license": "MIT",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
11 changes: 9 additions & 2 deletions sdk/zksync.js/src/remote-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export class RemoteWallet extends AbstractWallet {
}

override async syncSignerPubKeyHash(): Promise<PubKeyHash> {
return await this.callExtSignerPubKeyHash();
let pubKeyHash = await this.callExtSignerPubKeyHash();
pubKeyHash = pubKeyHash.replace('0x', 'sync:');
return pubKeyHash;
}

// *********************
Expand Down Expand Up @@ -382,10 +384,11 @@ export class RemoteWallet extends AbstractWallet {
*
* Makes all fields that represent amount to be of `string` type
* and all fields that represent tokens to be token ids i.e. of `number` type.
* Also, it renames `ethAddress` parameter to `to` for withdrawals.
*
* @param txs A list of transactions
*
* @protected A list of prepared transactions
* @returns A list of prepared transactions
*/
protected prepareTxsBeforeSending(txs: any[]): any[] {
const amountFields = ['amount', 'fee'];
Expand All @@ -404,6 +407,10 @@ export class RemoteWallet extends AbstractWallet {
if ('amounts' in tx) {
tx.amounts = [BigNumber.from(tx.amounts[0]).toString(), BigNumber.from(tx.amounts[1]).toString()];
}
if ('ethAddress' in tx) {
tx.to = tx.ethAddress;
delete tx.ethAddress;
}
return tx;
});
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/zksync.js/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class Wallet extends AbstractWallet {
}

override syncSignerConnected(): boolean {
return this.signer !== null;
return this.signer != null;
}

override async syncSignerPubKeyHash(): Promise<PubKeyHash> {
Expand Down

0 comments on commit 315d4d0

Please sign in to comment.