From 92dae869cf6d2483ffbe849f431d111d71c2f3ea Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Thu, 14 Dec 2023 18:22:08 +0530 Subject: [PATCH] feat(contract): support all names delegation to contract --- docs/guides/aens.md | 9 +++--- .../browser/aepp/src/DelegationSignature.vue | 10 +++++- examples/browser/wallet-iframe/src/App.vue | 11 +++++++ .../wallet-web-extension/src/background.js | 11 +++++++ src/AeSdkBase.ts | 11 +++++++ src/AeSdkWallet.ts | 4 ++- src/account/Base.ts | 21 ++++++++++++ src/account/Generalized.ts | 5 +++ src/account/Ledger.ts | 5 +++ src/account/Memory.ts | 15 +++++++++ src/account/Rpc.ts | 11 +++++++ src/aepp-wallet-communication/rpc/types.ts | 1 + test/integration/contract.ts | 32 ++++++++++++++++++- 13 files changed, 139 insertions(+), 7 deletions(-) diff --git a/docs/guides/aens.md b/docs/guides/aens.md index 761a1240f1..eebf9cbd89 100644 --- a/docs/guides/aens.md +++ b/docs/guides/aens.md @@ -371,13 +371,14 @@ const aeSdk = new AeSdk({ ... }) // init the SDK instance with AeSdk class const contractAddress = 'ct_asd2ks...' // AENS name const name = 'example.chain' -// Sign with a specific account -const onAccount = aeSdk.address // this signature will allow the contract to perform a pre-claim on your behalf -const preClaimSig = await aeSdk.createDelegationSignature(contractAddress, []) +const preClaimSig = await aeSdk.signDelegationToContract(contractAddress) // this signature will allow the contract to perform // any name related transaction for a specific name that you own -const aensDelegationSig = await aeSdk.createDelegationSignature(contractAddress, [name], { onAccount }) +const nameDelegationSig = await aeSdk.signNameDelegationToContract(contractAddress, name) + +// alternatively, you can generate a delegation signature suitable for every name you own +const allNamesDelegationSig = await aeSdk.signAllNamesDelegationToContract(contractAddress) ``` diff --git a/examples/browser/aepp/src/DelegationSignature.vue b/examples/browser/aepp/src/DelegationSignature.vue index b46b81d997..8e0a668c65 100644 --- a/examples/browser/aepp/src/DelegationSignature.vue +++ b/examples/browser/aepp/src/DelegationSignature.vue @@ -8,7 +8,7 @@
@@ -18,6 +18,12 @@
+
+ +