From e757834c07b0ad5edf97184f6d41a603e843c0c1 Mon Sep 17 00:00:00 2001 From: Darlington02 Date: Thu, 7 Mar 2024 02:24:14 +0100 Subject: [PATCH 1/2] chore: assign parentAccount as signer --- .../windowObject/tokenboundAccount.ts | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/connector/src/connector/windowObject/tokenboundAccount.ts b/connector/src/connector/windowObject/tokenboundAccount.ts index e1bace4..9653098 100644 --- a/connector/src/connector/windowObject/tokenboundAccount.ts +++ b/connector/src/connector/windowObject/tokenboundAccount.ts @@ -1,45 +1,19 @@ -import { - Signature, +import { Account, AccountInterface, ProviderInterface, - SignerInterface, Call, CallData, RawArgs } from "starknet"; -class UnimplementedSigner implements SignerInterface { - async getPubKey(): Promise { - throw new Error("Method not implemented"); - } - - async signMessage(): Promise { - throw new Error("Method not implemented"); - } - - async signTransaction(): Promise { - throw new Error("Method not implemented"); - } - - async signDeclareTransaction(): Promise { - throw new Error("Method not implemented"); - } - - async signDeployAccountTransaction(): Promise { - throw new Error("Method not implemented"); - } -} - export class TokenboundAccount extends Account implements AccountInterface { - public signer = new UnimplementedSigner(); - constructor( provider: ProviderInterface, public address: string, public parentAccount: AccountInterface ) { - super(provider, address, new UnimplementedSigner); + super(provider, address, parentAccount.signer); } override execute = async ( From 6c32adbe41fe8690b6802c01d6c1ea99a6152db3 Mon Sep 17 00:00:00 2001 From: Darlington02 Date: Thu, 7 Mar 2024 02:26:53 +0100 Subject: [PATCH 2/2] chore: add signMessage to SDK --- sdk/src/TokenboundClient.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sdk/src/TokenboundClient.ts b/sdk/src/TokenboundClient.ts index 80ff3e0..2ea7b7b 100644 --- a/sdk/src/TokenboundClient.ts +++ b/sdk/src/TokenboundClient.ts @@ -3,6 +3,7 @@ import { Contract, BigNumberish, CallData, + TypedData, cairo } from "starknet" @@ -222,5 +223,12 @@ export class TokenboundClient { } } - // implement signMessage method + public async signMessage(typedData: TypedData) { + try { + return await this.account.signMessage(typedData) + } + catch (error) { + throw error + } + } }