1 |
|
2 |
|
3 |
|
4 | import { BitGo } from '../bitgo';
|
5 | import * as Bluebird from 'bluebird';
|
6 | import { NodeCallback } from './types';
|
7 | import { Wallet } from './wallet';
|
8 | import { BaseCoin } from './baseCoin';
|
9 | export interface PendingApprovalInfo {
|
10 | type: Type;
|
11 | transactionRequest?: {
|
12 | coinSpecific: {
|
13 | [key: string]: any;
|
14 | };
|
15 | recipients: any;
|
16 | buildParams: {
|
17 | type?: 'fanout' | 'consolidate';
|
18 | [index: string]: any;
|
19 | };
|
20 | sourceWallet?: string;
|
21 | };
|
22 | }
|
23 | export interface PendingApprovalData {
|
24 | id: string;
|
25 | wallet?: string;
|
26 | enterprise?: string;
|
27 | state: State;
|
28 | creator: string;
|
29 | info: PendingApprovalInfo;
|
30 | approvalsRequired?: number;
|
31 | }
|
32 | export declare enum OwnerType {
|
33 | WALLET = "wallet",
|
34 | ENTERPRISE = "enterprise"
|
35 | }
|
36 | export declare enum State {
|
37 | PENDING = "pending",
|
38 | AWAITING_SIGNATURE = "awaitingSignature",
|
39 | PENDING_BITGO_ADMIN_APPROVAL = "pendingBitGoAdminApproval",
|
40 | PENDING_ID_VERIFICATION = "pendingIdVerification",
|
41 | PENDING_CUSTODIAN_APPROVAL = "pendingCustodianApproval",
|
42 | PENDING_FINAL_APPROVAL = "pendingFinalApproval",
|
43 | APPROVED = "approved",
|
44 | PROCESSING = "processing",
|
45 | REJECTED = "rejected"
|
46 | }
|
47 | export declare enum Type {
|
48 | USER_CHANGE_REQUEST = "userChangeRequest",
|
49 | TRANSACTION_REQUEST = "transactionRequest",
|
50 | POLICY_RULE_REQUEST = "policyRuleRequest",
|
51 | UPDATE_APPROVALS_REQUIRED_REQUEST = "updateApprovalsRequiredRequest"
|
52 | }
|
53 | export interface ApproveOptions {
|
54 | walletPassphrase?: string;
|
55 | otp?: string;
|
56 | tx?: string;
|
57 | xprv?: string;
|
58 | }
|
59 | export declare class PendingApproval {
|
60 | private readonly bitgo;
|
61 | private readonly baseCoin;
|
62 | private wallet?;
|
63 | private _pendingApproval;
|
64 | constructor(bitgo: BitGo, baseCoin: BaseCoin, pendingApprovalData: PendingApprovalData, wallet?: Wallet);
|
65 | /**
|
66 | * Get the id for this PendingApproval
|
67 | */
|
68 | id(): string;
|
69 | /**
|
70 | * Get the owner type (wallet or enterprise)
|
71 | * Pending approvals can be approved or modified by different scopes (depending on how they were created)
|
72 | * If a pending approval is owned by a wallet, then it can be approved by administrators of the wallet
|
73 | * If a pending approval is owned by an enterprise, then it can be approved by administrators of the enterprise
|
74 | */
|
75 | ownerType(): OwnerType;
|
76 | /**
|
77 | * Get the id of the wallet which is associated with this PendingApproval
|
78 | */
|
79 | walletId(): string | undefined;
|
80 | /**
|
81 | * Get the enterprise ID that is associated with this PendingApproval
|
82 | */
|
83 | enterpriseId(): string | undefined;
|
84 | /**
|
85 | * Get the state of this PendingApproval
|
86 | */
|
87 | state(): State;
|
88 | /**
|
89 | * Get the id of the user that performed the action resulting in this PendingApproval
|
90 | */
|
91 | creator(): string;
|
92 | /**
|
93 | * Get the type of the pending approval (what it approves)
|
94 | */
|
95 | type(): Type;
|
96 | /**
|
97 | * Get information about this PendingApproval
|
98 | */
|
99 | info(): PendingApprovalInfo;
|
100 | /**
|
101 | * Get the number of approvals that are required for this PendingApproval to be approved.
|
102 | * Defaults to 1 if approvalsRequired doesn't exist on the object
|
103 | */
|
104 | approvalsRequired(): number;
|
105 | /**
|
106 | * Generate a url for this PendingApproval for making requests to the server.
|
107 | * @param extra
|
108 | */
|
109 | url(extra?: string): string;
|
110 | /**
|
111 | * Refetches this PendingApproval from the server and returns it.
|
112 | *
|
113 | * Note that this mutates the PendingApproval object in place.
|
114 | * @param params
|
115 | * @param callback
|
116 | */
|
117 | get(params?: Record<string, never>, callback?: NodeCallback<PendingApproval>): Bluebird<PendingApproval>;
|
118 | /**
|
119 | * Helper function to ensure that self.wallet is set
|
120 | */
|
121 | private populateWallet;
|
122 | /**
|
123 | * Sets this PendingApproval to an approved state
|
124 | */
|
125 | approve(params?: ApproveOptions, callback?: NodeCallback<any>): Bluebird<any>;
|
126 | /**
|
127 | * Sets this PendingApproval to a rejected state
|
128 | * @param params
|
129 | * @param callback
|
130 | */
|
131 | reject(params?: Record<string, never>, callback?: NodeCallback<any>): Bluebird<any>;
|
132 | /**
|
133 | * Alias for PendingApproval.reject()
|
134 | *
|
135 | * @deprecated
|
136 | * @param params
|
137 | * @param callback
|
138 | */
|
139 | cancel(params?: {}, callback?: NodeCallback<any>): Bluebird<any>;
|
140 | /**
|
141 | * Recreate a transaction for a pending approval to respond to updated network conditions
|
142 | * @param params
|
143 | * @param callback
|
144 | */
|
145 | recreateAndSignTransaction(params?: any, callback?: NodeCallback<any>): Bluebird<any>;
|
146 | }
|
147 | //# sourceMappingURL=pendingApproval.d.ts.map |
\ | No newline at end of file |