From 831c653b63f4f14961b9035d9769fa45d6652c04 Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Tue, 13 Oct 2020 08:11:10 -0700 Subject: [PATCH] Update zksync to accomodate fee on setSigningKey --- app/assets/v2/js/cart.js | 10 ++++++++-- app/grants/templates/grants/cart-vue.html | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/v2/js/cart.js b/app/assets/v2/js/cart.js index 9db76764527..00d3fe3c438 100644 --- a/app/assets/v2/js/cart.js +++ b/app/assets/v2/js/cart.js @@ -1524,20 +1524,26 @@ Vue.component('grants-cart', { throw new Error('Unknown account'); } + // Get the first token listed and use that to pay for signing key transaction + const syncWalletState = await syncWallet.getAccountState(); + const tokensInWallet = Object.keys(syncWalletState.committed.balances); + const feeToken = tokensInWallet[0]; + // Determine how to set key based on wallet type let changePubkey; if (syncWallet.ethSignerType.verificationMethod === 'ECDSA') { console.log(' Using ECDSA to set signing key'); - changePubkey = await syncWallet.setSigningKey(); + changePubkey = await syncWallet.setSigningKey({ feeToken }); } else { console.log(' Using ERC-1271 to set signing key. This requires an on-chain transaction'); const signingKeyTx = await syncWallet.onchainAuthSigningKey(); - changePubkey = await syncWallet.setSigningKey('committed', true); + changePubkey = await syncWallet.setSigningKey({ feeToken, onchainAuth: true }); } // Wait until the tx is committed + console.log('Signing key set, waiting for transaction receipt'); await changePubkey.awaitReceipt(); console.log('✅ specified sync wallet is ready to use on zkSync'); } else { diff --git a/app/grants/templates/grants/cart-vue.html b/app/grants/templates/grants/cart-vue.html index 6b9460a6e83..c7d17312dfa 100644 --- a/app/grants/templates/grants/cart-vue.html +++ b/app/grants/templates/grants/cart-vue.html @@ -906,7 +906,7 @@

{% comment %} ================================================================= {% endcomment %} - +