Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

API Documentation

mace edited this page Jul 30, 2020 · 17 revisions

Filecoin Snap API

configure
configure(configuration: Partial<SnapConfig>): Promise<void>;

Configures snap for the specific network. It is possible to send custom configuration or select one from a set of predefined configurations by defining specific network.

There are two predefined configurations for testnet "t" and for mainet "f". If selecting a predefined configuration only network property is required.

export interface SnapConfig {
  derivationPath: string;
  token: string;
  network: FilecoinNetwork;
  rpcUrl: string;
  unit: UnitConfiguration;
}

It is also possible to choose a predefined configuration and only change some specific properties. In the example SnapConfig below we selected predefined configuration for testnet network and only changed URL for RPC endpoint (rpcUrl), all other properties will be the same as in predefined configuration for testnet network.


getPublicKey
getPublicKey(): Promise<string>

getAddress
getAddress(): Promise<string>

getBalance
getBalance(): Promise<string>

exportPrivateKey
exportPrivateKey(): Promise<string>

signMessage
signMessage(message: PartialMessage): Promise<SignedMessage>

signMessageRaw
signMessageRaw(message: string): Promise<string>

sendMessage
sendMessage(signedMessage: SignedMessage): Promise<BlockInfo>

getMessages
getMessages(): Promise<MessageStatus[]>

Clone this wiki locally