-
Notifications
You must be signed in to change notification settings - Fork 25
/
proxy.ts
49 lines (47 loc) · 1.1 KB
/
proxy.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
import {
Args,
BaseTxInfo,
defineMethod,
OptionsWithMeta,
UnsignedTransaction,
} from '@substrate/txwrapper-core';
export interface ProxyProxy extends Args {
/**
* Dispatch the given `call` from an account that the sender is authorized for
* through, `add_proxy`.
*/
real: string;
/**
* Specify the exact proxy type to be used and checked for this call.
*/
forceProxyType: string;
/**
* The call to be made by the `real` account.
* To take advantage of txwrapper methods, this could be UnsignedTransaction.method.
*/
call: { callIndex?: string; args?: string } | string;
}
/**
* Dispatch the given `call` from an account for which the sender is authorized.
*
* @param args - Arguments specific to this method.
* @param info - Information required to construct the transaction.
* @param options - Registry and metadata used for constructing the method.
*/
export function proxy(
args: ProxyProxy,
info: BaseTxInfo,
options: OptionsWithMeta
): UnsignedTransaction {
return defineMethod(
{
method: {
args,
name: 'proxy',
pallet: 'proxy',
},
...info,
},
options
);
}