-
Notifications
You must be signed in to change notification settings - Fork 695
/
interface.ts
77 lines (72 loc) · 2.62 KB
/
interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import {
Abi,
Call,
DeclareSignerDetails,
DeployAccountSignerDetails,
InvocationsSignerDetails,
Signature,
TypedData,
} from '../types';
export abstract class SignerInterface {
/**
* Method to get the public key of the signer
*
* @returns public key of signer as hex string with 0x prefix
*/
public abstract getPubKey(): Promise<string>;
/**
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
* This adds a message prefix so it cant be interchanged with transactions
*
* @param typedData - JSON object to be signed
* @param accountAddress - account
* @returns the signature of the JSON object
* @throws {Error} if the JSON object is not a valid JSON
*/
public abstract signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
/**
* Signs a transaction with the starknet private key and returns the signature
*
* @param invocation the invocation object containing:
* - contractAddress - the address of the contract
* - entrypoint - the entrypoint of the contract
* - calldata - (defaults to []) the calldata
* @param abi (optional) the abi of the contract for better displaying
*
* @returns signature
*/
public abstract signTransaction(
transactions: Call[],
transactionsDetail: InvocationsSignerDetails,
abis?: Abi[]
): Promise<Signature>;
/**
* Signs a DEPLOY_ACCOUNT transaction with the starknet private key and returns the signature
*
* @param transaction
* - contractAddress - the computed address of the contract
* - constructorCalldata - calldata to be passed in deploy constructor
* - addressSalt - contract address salt
* - chainId - the chainId to declare contract on
* - maxFee - maxFee for the declare transaction
* - version - transaction version
* - nonce - Nonce of the declare transaction
* @returns signature
*/
public abstract signDeployAccountTransaction(
transaction: DeployAccountSignerDetails
): Promise<Signature>;
/**
* Signs a DECLARE transaction with the starknet private key and returns the signature
*
* @param transaction
* - classHash - computed class hash. Will be replaced by ContractClass in future once class hash is present in CompiledContract
* - senderAddress - the address of the sender
* - chainId - the chainId to declare contract on
* - maxFee - maxFee for the declare transaction
* - version - transaction version
* - nonce - Nonce of the declare transaction
* @returns signature
*/
public abstract signDeclareTransaction(transaction: DeclareSignerDetails): Promise<Signature>;
}