-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webwallet): support of web wallets
- Loading branch information
Showing
41 changed files
with
3,477 additions
and
296 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { ChildApi } from "./connection" | ||
import type { AsyncMethodReturns } from "penpal" | ||
import { | ||
Abi, | ||
Account, | ||
AccountInterface, | ||
AllowArray, | ||
Call, | ||
InvocationsDetails, | ||
InvokeFunctionResponse, | ||
ProviderInterface, | ||
Signature, | ||
SignerInterface, | ||
typedData, | ||
} 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 MessageAccount extends Account implements AccountInterface { | ||
public signer = new UnimplementedSigner() | ||
|
||
constructor( | ||
provider: ProviderInterface, | ||
public address: string, | ||
private readonly child: AsyncMethodReturns<ChildApi>, | ||
) { | ||
super(provider, address, new UnimplementedSigner()) | ||
} | ||
|
||
execute( | ||
calls: AllowArray<Call>, | ||
abis?: Abi[] | undefined, | ||
transactionsDetail?: InvocationsDetails | undefined, | ||
): Promise<InvokeFunctionResponse> { | ||
return this.child.execute(calls, abis, transactionsDetail) | ||
} | ||
|
||
signMessage(typedData: typedData.TypedData): Promise<Signature> { | ||
return this.child.signMessage(typedData) | ||
} | ||
} |
Oops, something went wrong.