Skip to content

Commit

Permalink
Merge pull request #39 from Darlington02/develop
Browse files Browse the repository at this point in the history
chore: assign parent account as signer
  • Loading branch information
Darlington02 authored Mar 7, 2024
2 parents e781ca6 + 390b326 commit 2df6211
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
30 changes: 2 additions & 28 deletions connector/src/connector/windowObject/tokenboundAccount.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,19 @@
import {
Signature,
import {
Account,
AccountInterface,
ProviderInterface,
SignerInterface,
Call,
CallData,
RawArgs
} from "starknet";

class UnimplementedSigner implements SignerInterface {
async getPubKey(): Promise<string> {
throw new Error("Method not implemented");
}

async signMessage(): Promise<Signature> {
throw new Error("Method not implemented");
}

async signTransaction(): Promise<Signature> {
throw new Error("Method not implemented");
}

async signDeclareTransaction(): Promise<Signature> {
throw new Error("Method not implemented");
}

async signDeployAccountTransaction(): Promise<Signature> {
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 (
Expand Down
10 changes: 9 additions & 1 deletion sdk/src/TokenboundClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Contract,
BigNumberish,
CallData,
TypedData,
cairo
} from "starknet"

Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 2df6211

Please sign in to comment.