import { common, smartwalletallowance } from "@koinosbox/contracts"; import { manuscriptwallet } from "./proto/manuscriptwallet"; import { authority, System, Protobuf, StringBytes } from "@koinos/sdk-as"; import { ISmartWalletAllowance as SmartWalletAllowance } from "@koinosbox/contracts"; export class ManuscriptWallet extends SmartWalletAllowance { /** * @external * @readonly */ get_nonce(): common.uint32 { const argsBuffer = new Uint8Array(0); const callRes = System.call(this._contractId, 0x8e465905, argsBuffer); if (callRes.code != 0) { const errorMessage = `failed to call 'ManuscriptWallet.get_nonce': ${callRes.res.error && callRes.res.error!.message ? callRes.res.error!.message : "unknown error"}`; System.exit(callRes.code, StringBytes.stringToBytes(errorMessage)); } if (!callRes.res.object) return new common.uint32(); return Protobuf.decode(callRes.res.object, common.uint32.decode); } /** * @external * @readonly */ get_authorities(): manuscriptwallet.authorities { const argsBuffer = new Uint8Array(0); const callRes = System.call(this._contractId, 0xd93a59eb, argsBuffer); if (callRes.code != 0) { const errorMessage = `failed to call 'ManuscriptWallet.get_authorities': ${callRes.res.error && callRes.res.error!.message ? callRes.res.error!.message : "unknown error"}`; System.exit(callRes.code, StringBytes.stringToBytes(errorMessage)); } if (!callRes.res.object) return new manuscriptwallet.authorities(); return Protobuf.decode(callRes.res.object, manuscriptwallet.authorities.decode); } /** * @external * @event manuscriptwallet.authorities manuscriptwallet.authorities */ set_authorities(args: manuscriptwallet.authorities): void { const argsBuffer = Protobuf.encode(args, manuscriptwallet.authorities.encode); const callRes = System.call(this._contractId, 0x478e1871, argsBuffer); if (callRes.code != 0) { const errorMessage = `failed to call 'ManuscriptWallet.set_authorities': ${callRes.res.error && callRes.res.error!.message ? callRes.res.error!.message : "unknown error"}`; System.exit(callRes.code, StringBytes.stringToBytes(errorMessage)); } return; } /** * Set an allowance in user's contract * @external */ set_allowance(args: smartwalletallowance.allowance): void { const argsBuffer = Protobuf.encode(args, smartwalletallowance.allowance.encode); const callRes = System.call(this._contractId, 0xb1569611, argsBuffer); if (callRes.code != 0) { const errorMessage = `failed to call 'ManuscriptWallet.set_allowance': ${callRes.res.error && callRes.res.error!.message ? callRes.res.error!.message : "unknown error"}`; System.exit(callRes.code, StringBytes.stringToBytes(errorMessage)); } return; } /** * Execute a text plain transaction * @external */ execute_transaction(args: manuscriptwallet.execute_transaction_args): void { const argsBuffer = Protobuf.encode(args, manuscriptwallet.execute_transaction_args.encode); const callRes = System.call(this._contractId, 0x05fa2e2f, argsBuffer); if (callRes.code != 0) { const errorMessage = `failed to call 'ManuscriptWallet.execute_transaction': ${callRes.res.error && callRes.res.error!.message ? callRes.res.error!.message : "unknown error"}`; System.exit(callRes.code, StringBytes.stringToBytes(errorMessage)); } return; } /** * Authorize function * @external */ authorize(args: authority.authorize_arguments): authority.authorize_result { const argsBuffer = Protobuf.encode(args, authority.authorize_arguments.encode); const callRes = System.call(this._contractId, 0x4a2dbd90, argsBuffer); if (callRes.code != 0) { const errorMessage = `failed to call 'ManuscriptWallet.authorize': ${callRes.res.error && callRes.res.error!.message ? callRes.res.error!.message : "unknown error"}`; System.exit(callRes.code, StringBytes.stringToBytes(errorMessage)); } if (!callRes.res.object) return new authority.authorize_result(); return Protobuf.decode(callRes.res.object, authority.authorize_result.decode); } }