WXL
3 天以前 4d9da000fbe74d344e0e4580b138e79d4ad98ede
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
import { type Key } from "@uni-sign/utils";
import Decimal from "decimal.js";
import { Signature } from "./auth";
import { SignResponse } from "./wallet";
export interface HttpEndpoint {
    url: string;
    headers: Record<string, string>;
}
export interface Price {
    amount: Decimal;
    denom: string;
}
export interface SignerConfig {
    publicKey: {
        isCompressed: boolean;
        hash(publicKey: Key): Key;
    };
    message: {
        hash(message: Uint8Array): Uint8Array;
    };
    signature: {
        fromCompact(key: Key, algo: string): Signature;
        toCompact(signature: Signature, algo: string): Key;
    };
}
export interface BroadcastOptions {
    checkTx?: boolean;
    deliverTx?: boolean;
}
export interface UniSigner<SignDoc> {
    publicKey: Key;
    /**
     * publicKeyHash is usually used to get address.
     * - for cosmos chains: publicKeyHash.toBech32(prefix)
     * - for ethereum chains: publicKeyHash.toPrefixedHex()
     */
    publicKeyHash: Key;
    signArbitrary(message: Uint8Array): Key;
    verifyArbitrary(message: Uint8Array, signature: Key): boolean;
    broadcastArbitrary(message: Uint8Array, options?: BroadcastOptions): Promise<unknown>;
    signDoc: (doc: SignDoc) => Promise<SignResponse<SignDoc>>;
}