feat: Add optional getAddress method to Signature

This commit is contained in:
Michał Konopka
2023-03-02 23:08:56 +01:00
committed by Mike
parent f25ac04a65
commit 618ea26fa3
8 changed files with 172 additions and 31 deletions

View File

@@ -668,15 +668,7 @@ export class HandlerBasedContract<State> implements Contract<State> {
if (caller) {
effectiveCaller = caller;
} else if (this.signature) {
// we're creating this transaction just to call the signing function on it
// - and retrieve the caller/owner
const dummyTx = await arweave.createTransaction({
data: Math.random().toString().slice(-4),
reward: '72600854',
last_tx: 'p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO'
});
await this.signature.signer(dummyTx);
effectiveCaller = await arweave.wallets.ownerToAddress(dummyTx.owner);
effectiveCaller = await this.signature.getAddress();
} else {
effectiveCaller = '';
}