( operationList: OperationStruct[], wallet: ethers.Wallet, targetDARCAddress: string, notes?: string, delegateToAddress?: string )
| 88 | * @param delegateToAddress If the signer is not the operator, but the operator has approved the signer to sign on its behalf, then the signer can set this parameter to the operator's address. Otherwise, leave it undefined. |
| 89 | */ |
| 90 | export async function executeOperationList( |
| 91 | operationList: OperationStruct[], |
| 92 | wallet: ethers.Wallet, |
| 93 | targetDARCAddress: string, |
| 94 | notes?: string, |
| 95 | delegateToAddress?: string |
| 96 | ) { |
| 97 | |
| 98 | const operatorAddress = delegateToAddress? delegateToAddress : wallet.address; |
| 99 | for (let i = 0; i < operationList.length; i++) { |
| 100 | operationList[i].operatorAddress = operatorAddress; |
| 101 | } |
| 102 | const program:ProgramStruct = { |
| 103 | programOperatorAddress: operatorAddress, |
| 104 | operations: operationList, |
| 105 | notes: notes? notes : "" |
| 106 | }; |
| 107 | |
| 108 | const attachedDARC = new DARC.DARC({ |
| 109 | address: targetDARCAddress, |
| 110 | version: DARC.DARC_VERSION.Latest, |
| 111 | wallet: wallet, |
| 112 | }); |
| 113 | |
| 114 | await attachedDARC.entrance(program); |
| 115 | } |
| 116 | |
| 117 | |
| 118 |
no test coverage detected