Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | 1x 1x 1x 1x 1x 2x 1x 1x 1x 2x 1x 1x 1x 2x 1x 1x 2x 1x 1x 1x 1x 2x 1x 1x 1x 2x 1x 1x 1x 1x 1x 2x 1x 1x 1x 1x 2x 1x 2x | import {Action, Asset, AssetType, Name, NameType, Struct} from '@greymass/eosio' // Temporarily use a custom version of Contract class. import {Contract} from '../../tmp/contract' class ResourceActions extends Contract { static account = Name.from('eosio') async buyRam(payer: NameType, receiver: NameType, quant: AssetType, sessionData?: any) { return this.call('buyram', ResourceActions.Types.BuyRam.from({payer, receiver, quant})) } async buyRamBytes(payer: NameType, receiver: NameType, bytes: number, sessionData?: any) { return this.call( 'buyrambytes', ResourceActions.Types.BuyRamBytes.from({payer, receiver, bytes}) ) } async sellRam(account: NameType, bytes: number, sessionData?: any) { return this.call('sellram', ResourceActions.Types.SellRam.from({account, bytes})) } async delegateResources( from: NameType, receiver: NameType, stake_net_quantity: AssetType, stake_cpu_quantity: AssetType, transfer = false, sessionData?: any ) { return this.call( 'delegatebw', ResourceActions.Types.DelegateCpu.from({ from, receiver, stake_net_quantity, stake_cpu_quantity, transfer, }) ) } async undelegateResources( from: NameType, receiver: NameType, unstake_net_quantity: AssetType, unstake_cpu_quantity: AssetType, sessionData?: any ) { return this.call( 'undelegatebw', ResourceActions.Types.UndelegateCpu.from({ from, receiver, unstake_net_quantity, unstake_cpu_quantity, }) ) } async refundCpu(owner: NameType, sessionData?: any) { return this.call('refund', ResourceActions.Types.Refund.from({owner})) } async buyRamAction( payer: NameType, receiver: NameType, quant: AssetType, sessionData?: any ): Promise<Action> { return this.getAction('buyram', ResourceActions.Types.BuyRam.from({payer, receiver, quant})) } async buyRamBytesAction( payer: NameType, receiver: NameType, bytes: number, sessionData?: any ): Promise<Action> { return this.getAction( 'buyrambytes', ResourceActions.Types.BuyRamBytes.from({payer, receiver, bytes}) ) } async sellRamAction(account: NameType, bytes: number, sessionData?: any): Promise<Action> { return this.getAction('sellram', ResourceActions.Types.SellRam.from({account, bytes})) } async delegateResourcesAction( from: NameType, receiver: NameType, stake_net_quantity: AssetType, stake_cpu_quantity: AssetType, transfer: boolean, sessionData?: any ): Promise<Action> { return this.getAction( 'delegatebw', ResourceActions.Types.DelegateCpu.from({ from, receiver, stake_net_quantity, stake_cpu_quantity, transfer, }) ) } async undelegateResourcesAction( from: NameType, receiver: NameType, unstake_net_quantity: AssetType, unstake_cpu_quantity: AssetType, sessionData?: any ): Promise<Action> { return this.getAction( 'undelegatebw', ResourceActions.Types.UndelegateCpu.from({ from, receiver, unstake_net_quantity, unstake_cpu_quantity, }) ) } } namespace ResourceActions { export namespace Types { @Struct.type('buyram') export class BuyRam extends Struct { @Struct.field('name') declare payer: Name @Struct.field('name') declare receiver: Name @Struct.field('asset') declare quant: Asset } @Struct.type('buyrambytes') export class BuyRamBytes extends Struct { @Struct.field('name') declare payer: Name @Struct.field('name') declare receiver: Name @Struct.field('uint32') declare bytes: number } @Struct.type('sellram') export class SellRam extends Struct { @Struct.field('name') declare account: Name @Struct.field('uint64') declare bytes: number } @Struct.type('delegatecpu') export class DelegateCpu extends Struct { @Struct.field('name') declare from: Name @Struct.field('name') declare receiver: Name @Struct.field('asset') declare stake_cpu_quantity: Asset @Struct.field('bool') declare transfer: boolean } @Struct.type('undelegatecpu') export class UndelegateCpu extends Struct { @Struct.field('name') declare from: Name @Struct.field('name') declare receiver: Name @Struct.field('asset') declare unstake_cpu_quantity: Asset } @Struct.type('delegatebw') export class DelegateBandwidth extends Struct { @Struct.field('name') declare from: Name @Struct.field('name') declare receiver: Name @Struct.field('asset') declare stake_net_quantity: Asset @Struct.field('asset') declare stake_cpu_quantity: Asset @Struct.field('bool') declare transfer: boolean } @Struct.type('undelegatebw') export class UndelegateBandwidth extends Struct { @Struct.field('name') declare from: Name @Struct.field('name') declare receiver: Name @Struct.field('asset') declare unstake_net_quantity: Asset @Struct.field('asset') declare unstake_cpu_quantity: Asset } @Struct.type('refund') export class Refund extends Struct { @Struct.field('name') declare owner: Name } } } export {ResourceActions} |