@mysten/sui.js
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -1,2 +0,2 @@ | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferCoinTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferCoin, RawAuthoritySignInfo, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, Event, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index"; | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferCoinTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferCoin, RawAuthoritySignInfo, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index"; | ||
export declare function isEd25519KeypairData(obj: any, _argumentName?: string): obj is Ed25519KeypairData; | ||
@@ -47,3 +47,2 @@ export declare function isKeypair(obj: any, _argumentName?: string): obj is Keypair; | ||
export declare function isGetTxnDigestsResponse(obj: any, _argumentName?: string): obj is GetTxnDigestsResponse; | ||
export declare function isEvent(obj: any, _argumentName?: string): obj is Event; | ||
export declare function isMoveCall(obj: any, _argumentName?: string): obj is MoveCall; | ||
@@ -50,0 +49,0 @@ export declare function isSuiJsonValue(obj: any, _argumentName?: string): obj is SuiJsonValue; |
@@ -16,2 +16,4 @@ import { Provider } from './provider'; | ||
getObjectBatch(objectIds: string[]): Promise<GetObjectDataResponse[]>; | ||
getTransactionsForObject(objectID: string): Promise<GetTxnDigestsResponse>; | ||
getTransactionsForAddress(addressID: string): Promise<GetTxnDigestsResponse>; | ||
getTransactionWithEffects(digest: TransactionDigest): Promise<TransactionEffectsResponse>; | ||
@@ -18,0 +20,0 @@ getTransactionWithEffectsBatch(digests: TransactionDigest[]): Promise<TransactionEffectsResponse[]>; |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("tweetnacl")),r=require("buffer"),n=require("bn.js"),i=t(n),o=require("js-sha3"),u=require("util"),s=t(require("jayson/lib/client/browser")),a=t(require("cross-fetch")),c=function(){function t(t){this.data="string"==typeof t?new Uint8Array(r.Buffer.from(t,"base64")):t}var e=t.prototype;return e.getData=function(){return this.data},e.getLength=function(){return this.data.length},e.toString=function(){return r.Buffer.from(this.data).toString("base64")},t}(),f=function(){function t(t){if(function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){var e=r.Buffer.from(t,"base64");if(32!==e.length)throw new Error("Invalid public key input. Expected 32 bytes, got "+e.length);this._bn=new i(e)}else this._bn=new i(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}var e=t.prototype;return e.equals=function(t){return this._bn.eq(t._bn)},e.toBase64=function(){return this.toBuffer().toString("base64")},e.toBytes=function(){return this.toBuffer()},e.toBuffer=function(){var t=this._bn.toArrayLike(r.Buffer);if(32===t.length)return t;var e=r.Buffer.alloc(32);return t.copy(e,32-t.length),e},e.toString=function(){return this.toBase64()},e.toSuiAddress=function(){var t=o.sha3_256(this.toBytes());return new i(t,16).toArray(void 0,32).slice(0,20).reduce((function(t,e){return t+("0"+e.toString(16)).slice(-2)}),"")},t}(),p=function(){function t(t){this.keypair=t||e.sign.keyPair()}t.generate=function(){return new t(e.sign.keyPair())},t.fromSecretKey=function(r,n){var i=e.sign.keyPair.fromSecretKey(r);if(!n||!n.skipValidation){var o=(new u.TextEncoder).encode("sui validation"),s=e.sign.detached(o,i.secretKey);if(!e.sign.detached.verify(o,s,i.publicKey))throw new Error("provided secretKey is invalid")}return new t(i)},t.fromSeed=function(r){return new t(e.sign.keyPair.fromSeed(r))};var r=t.prototype;return r.getPublicKey=function(){return new f(this.keypair.publicKey)},r.signData=function(t){return new c(e.sign.detached(t.getData(),this.keypair.secretKey))},t}(),h=function(){};function y(t,e,r,n,i,o,u){try{var s=t[o](u),a=s.value}catch(t){return void r(t)}s.done?e(a):Promise.resolve(a).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function u(t){y(o,n,i,u,s,"next",t)}function s(t){y(o,n,i,u,s,"throw",t)}u(void 0)}))}}function d(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function g(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return v(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var w,b=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",u=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),o=new T(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var s=x(u,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var a=c(t,e,r);if("normal"===a.type){if(n=r.done?"completed":"suspendedYield",a.arg===f)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n="completed",r.method="throw",r.arg=a.arg)}}}(t,r,o),i}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var f={};function p(){}function h(){}function y(){}var l={};s(l,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(E([])));v&&v!==e&&r.call(v,i)&&(l=v);var g=y.prototype=p.prototype=Object.create(l);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(i,o){function u(){return new e((function(n,u){!function n(i,o,u,s){var a=c(t[i],t,o);if("throw"!==a.type){var f=a.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(p).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,s)}))}s(a.arg)}(i,o,n,u)}))}return n=n?n.then(u,u):u()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function E(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=y,s(g,"constructor",y),s(y,"constructor",h),h.displayName=s(y,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},w(b.prototype),s(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var u=new b(a(e,r,n,i),o);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},w(g),s(g,u,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),a=r.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;j(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(w={exports:{}}),w.exports);function x(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t._bn instanceof n.BN}function m(t,e){return"string"==typeof t}function j(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.AddressOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.ObjectOwner)||"Shared"===t||"Immutable"===t}function T(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.digest)&&m(t.objectId)&&L(t.version)}function E(t,e){return T(t)&&(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type)&&j(t.owner)&&m(t.previousTransaction)}function A(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){return m(t[0])}))}function S(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){var e=t[0];return m(t[1])&&m(e)}))}function O(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&C(t)||(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&k(t)}function C(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type)&&A(t.fields)}function k(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&S(t.disassembled)}function B(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&O(t.data)&&j(t.owner)&&m(t.previousTransaction)&&L(t.storageRebate)&&T(t.reference)}function R(t,e){return"Exists"===t||"NotExists"===t||"Deleted"===t}function P(t,e){return"moveObject"===t||"package"===t}function _(t,e){return Array.isArray(t)&&t.every((function(t){return E(t)}))}function I(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&R(t.status)&&(m(t.details)||T(t.details)||B(t.details))}function L(t,e){return"number"==typeof t}function N(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.recipient)&&T(t.objectRef)}function D(t,e){return Array.isArray(t)&&m(t[0])&&m(t[1])}function q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&N(t.TransferCoin)||(null!==t&&"object"==typeof t||"function"==typeof t)&&k(t.Publish)||(null!==t&&"object"==typeof t||"function"==typeof t)&&Y(t.Call)}function U(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.transactions)&&t.transactions.every((function(t){return q(t)}))&&m(t.sender)&&T(t.gasPayment)&&L(t.gasBudget)}function V(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&L(t.epoch)&&Array.isArray(t.signatures)&&t.signatures.every((function(t){return D(t)}))}function M(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.transactionDigest)&&U(t.data)&&m(t.txSignature)&&V(t.authSignInfo)}function K(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&L(t.computationCost)&&L(t.storageCost)&&L(t.storageRebate)}function G(t,e){return"success"===t||"failure"===t}function W(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&G(t.status)&&K(t.gas_cost)&&(void 0===t.error||m(t.error))}function z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&j(t.owner)&&T(t.reference)}function F(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&W(t.status)&&(void 0===t.sharedObjects||Array.isArray(t.sharedObjects)&&t.sharedObjects.every((function(t){return T(t)})))&&m(t.transactionDigest)&&(void 0===t.created||Array.isArray(t.created)&&t.created.every((function(t){return z(t)})))&&(void 0===t.mutated||Array.isArray(t.mutated)&&t.mutated.every((function(t){return z(t)})))&&(void 0===t.unwrapped||Array.isArray(t.unwrapped)&&t.unwrapped.every((function(t){return z(t)})))&&(void 0===t.deleted||Array.isArray(t.deleted)&&t.deleted.every((function(t){return T(t)})))&&(void 0===t.wrapped||Array.isArray(t.wrapped)&&t.wrapped.every((function(t){return T(t)})))&&z(t.gasObject)&&(void 0===t.events||Array.isArray(t.events)&&t.events.every((function(t){return $(t)})))&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every((function(t){return m(t)})))}function Z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&F(t.effects)}function J(t,e){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&L(t[0])&&m(t[1])}))}function $(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type_)}function Y(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&T(t.package)&&m(t.module)&&m(t.function)&&(void 0===t.typeArguments||Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return m(t)})))&&(void 0===t.arguments||Array.isArray(t.arguments)&&t.arguments.every((function(t){return Q(t)})))}function Q(t,e){return m(t)||L(t)||!1===t||!0===t||Array.isArray(t)&&t.every((function(t){return m(t)||L(t)||!1===t||!0===t}))}function X(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.txBytes)&&T(t.gas)}function H(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&B(t.updatedCoin)&&B(t.updatedGas)}function tt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&B(t.updatedCoin)&&Array.isArray(t.newCoins)&&t.newCoins.every((function(t){return B(t)}))&&B(t.updatedGas)}function et(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Z(t.EffectResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&tt(t.SplitCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&H(t.MergeCoinResponse)}function rt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"2.0"===t.jsonrpc&&m(t.id)}var nt=require("lossless-json"),it=function(){function t(t,e){this.rpcClient=this.createRpcClient(t,e)}var e=t.prototype;return e.createRpcClient=function(t,e){return new s(function(){var r=l(b.mark((function r(n,i){var o,u,s,c;return b.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o={method:"POST",body:n,headers:Object.assign({"Content-Type":"application/json"},e||{})},r.prev=1,r.next=4,a(t,o);case 4:return u=r.sent,r.next=7,u.text();case 7:s=r.sent,c=JSON.stringify(nt.parse(s,(function(t,e){if("balance"===t)return e.toString();try{if(e.isLosslessNumber)return e.valueOf()}catch(t){return e.toString()}return e}))),u.ok?i(null,c):i(new Error(u.status+" "+u.statusText+": "+s)),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),r.t0 instanceof Error&&i(r.t0);case 15:case"end":return r.stop()}}),r,null,[[1,12]])})));return function(t,e){return r.apply(this,arguments)}}(),{})},e.requestWithType=function(){var t=l(b.mark((function t(e,r,n){var i;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.request(e,r);case 2:if((null===(o=i=t.sent)||"object"!=typeof o)&&"function"!=typeof o||"2.0"!==o.jsonrpc||!m(o.id)||(null===o.error||"object"!=typeof o.error)&&"function"!=typeof o.error||!m(o.error.message)){t.next=7;break}throw new Error("RPC Error: "+i.error.message);case 7:if(!rt(i)){t.next=13;break}if(!n(i.result)){t.next=12;break}return t.abrupt("return",i.result);case 12:throw new Error("RPC Error: result not of expected type. Result received was: "+JSON.stringify(i.result));case 13:throw new Error("Unexpected RPC Response: "+i);case 14:case"end":return t.stop()}var o}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.request=function(){var t=l(b.mark((function t(e,r){var n=this;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,i){n.rpcClient.request(e,r,(function(e,r){e?i(e):t(r)}))})));case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e.batchRequestWithType=function(){var t=l(b.mark((function t(e,r){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.batchRequest(e);case 2:return n=t.sent.filter((function(t){return rt(t)&&r(t.result)})),t.abrupt("return",n.map((function(t){return t.result})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.batchRequest=function(){var t=l(b.mark((function t(e){var r=this;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){0===e.length&&t([]);var i=e.map((function(t){return r.rpcClient.request(t.method,t.args)}));r.rpcClient.request(i,(function(e,r){e?n(e):t(r)}))})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t}(),ot=function(t){return"number"==typeof t},ut=function(t){function e(e){var r;return(r=t.call(this)||this).endpoint=e,r.client=new it(e),r}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObjectsOwnedByAddress",[e],_);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching owned object: "+t.t0+" for address "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObjectsOwnedByObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObjectsOwnedByObject",[e],_);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching owned object: "+t.t0+" for objectId "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObject",[e],I);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching object info: "+t.t0+" for id "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObjectBatch=function(){var t=l(b.mark((function t(e){var r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{method:"sui_getObject",args:[t]}})),t.prev=1,t.next=4,this.client.batchRequestWithType(r,I);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),new Error("Error fetching object info: "+t.t0+" for id "+e);case 10:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffects=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransaction",[e],Z);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error getting transaction with effects: "+t.t0+" for digest "+e);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffectsBatch=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{method:"sui_getTransaction",args:[t]}})),t.prev=1,t.next=4,this.client.batchRequestWithType(r,Z);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),n=e.join(", ").substring(0,-2),new Error("Error getting transaction effects: "+t.t0+" for digests ["+n+"]");case 11:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=l(b.mark((function t(e,r,n){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_executeTransaction",[e,r,n],et);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error executing transaction: "+t.t0+"}");case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getTotalTransactionNumber=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTotalTransactionNumber",[],ot);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error fetching total transaction number: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(){return t.apply(this,arguments)}}(),r.getTransactionDigestsInRange=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransactionsInRange",[e,r],J);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching transaction digests in range: "+t.t0+" for range "+e+"-"+r);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}(),r.getRecentTransactions=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getRecentTransactions",[e],J);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching recent transactions: "+t.t0+" for count "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),e}(h),st=function(){function t(t){this._data="string"==typeof t?new Uint8Array(r.Buffer.from(t,"hex")):t}var e=t.prototype;return e.getData=function(){return this._data},e.getLength=function(){return this._data.length},e.toString=function(){return r.Buffer.from(this._data).toString("hex")},t}(),at=function(){function t(t){this.client=new it(t)}var e=t.prototype;return e.newTransferCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_transferCoin",[e,r.objectId,r.gasPayment,r.gasBudget,r.recipient],X);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error transferring coin: "+t.t0+" with args "+r);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newMoveCall=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_moveCall",[e,r.packageObjectId,r.module,r.function,r.typeArguments,r.arguments,r.gasPayment,r.gasBudget],X);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error executing a move call: "+t.t0+" with args "+r);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newMergeCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_mergeCoins",[e,r.primaryCoin,r.coinToMerge,r.gasPayment,r.gasBudget],X);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error merging coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newSplitCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_splitCoin",[e,r.coinObjectId,r.splitAmounts,r.gasPayment,r.gasBudget],X);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error splitting coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),t}(),ct=function(t){function e(){return t.apply(this,arguments)||this}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getOwnedObjects");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getObject");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getTransaction=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTransaction");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=l(b.mark((function t(e,r,n){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("executeTransaction");case 1:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getTotalTransactionNumber=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTotalTransactionNumber");case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getTransactionDigestsInRange=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTransactionDigestsInRange");case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getRecentTransactions=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getRecentTransactions");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.newError=function(t){return new Error("Please use a valid provider for "+t)},e}(h),ft=function(){function t(t,e){this.provider=t||new ct;var r="";this.provider instanceof ut&&(r=this.provider.endpoint),this.serializer=e||new at(r)}var e=t.prototype;return e.signAndExecuteTransaction=function(){var t=l(b.mark((function t(e){var r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.signData(e);case 2:return r=t.sent,t.next=5,this.provider.executeTransaction(e.toString(),r.signature.toString(),r.pubKey.toString());case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.transferCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newTransferCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.mergeCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newMergeCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.splitCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newSplitCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.executeMoveCall=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newMoveCall(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),pt=function(t){function e(e,r,n){var i;return(i=t.call(this,r,n)||this).keypair=e,i}d(e,t);var r=e.prototype;return r.getAddress=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.keypair.getPublicKey().toSuiAddress());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.signData=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{signature:this.keypair.signData(e),pubKey:this.keypair.getPublicKey()});case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.connect=function(t){return new e(this.keypair,t)},e}(ft),ht=/^(?:[a-zA-Z0-9+\/]{4})*(?:|(?:[a-zA-Z0-9+\/]{3}=)|(?:[a-zA-Z0-9+\/]{2}==)|(?:[a-zA-Z0-9+\/]{1}===))$/;function yt(t){return function(t){return/^(0x|0X)?[a-fA-F0-9]+$/.test(t)&&t.length%2==0}(t)&&20===function(t){return/^(0x|0X)/.test(t)?(t.length-2)/2:t.length/2}(t)}function lt(t){return"Exists"!==t.status?void 0:t.details}function dt(t){return"Deleted"!==t.status?void 0:t.details}function vt(t){return"NotExists"!==t.status?void 0:t.details}function gt(t){var e;return(null==(e=lt(t))?void 0:e.reference)||dt(t)}function wt(t){var e;return null==(e=xt(t))?void 0:e.type}function bt(t){var e;return null==(e=xt(t))?void 0:e.fields}function xt(t){var e="data"in t?t:lt(t);if("moveObject"===(null==e?void 0:e.data.dataType))return e.data}function mt(t){return t.effects.status}function jt(t){return mt(t).gas_cost}function Tt(t){return"SplitCoinResponse"in t?t.SplitCoinResponse:void 0}function Et(t){return"MergeCoinResponse"in t?t.MergeCoinResponse:void 0}var At=function(){function t(){}return t.isCoin=function(t){var e,r;return null!=(e=null==(r=wt(t))?void 0:r.startsWith("0x2::Coin::Coin"))&&e},t.getBalance=function(e){var r;if(t.isCoin(e)){var n=null==(r=bt(e))?void 0:r.balance;return new i.BN(n,10)}},t.getZero=function(){return new i.BN("0",10)},t}(),St=function(){function t(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}var e=t.prototype;return e.shift=function(t){return this.bytePosition+=t,this},e.read8=function(){var t=this.dataView.getUint8(this.bytePosition);return this.shift(1),new n.BN(t,10)},e.read16=function(){var t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),new n.BN(t,10)},e.read32=function(){var t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),new n.BN(t,10)},e.read64=function(){var t=this.read32(),e=this.read32().toString(16)+t.toString(16).padStart(8,"0");return new n.BN(e,16)},e.read128=function(){var t=this.read64(),e=this.read64().toString(16)+t.toString(16).padStart(8,"0");return new n.BN(e,16)},e.readBytes=function(t){var e=new Uint8Array(this.dataView.buffer,this.bytePosition+this.dataView.byteOffset,t);return this.shift(t),e},e.readULEB=function(){var t=function(t){for(var e=0,r=0,n=0;;){var i=t[n];if(n+=1,e|=(127&i)<<r,0==(128&i))break;r+=7}return{value:e,length:n}}(new Uint8Array(this.dataView.buffer,this.bytePosition+this.dataView.byteOffset)),e=t.value;return this.shift(t.length),e},e.readVec=function(t){for(var e=this.readULEB(),r=[],n=0;n<e;n++)r.push(t(this,n,e));return r},t}(),Ot=function(){function t(t){void 0===t&&(t=1024),this.bytePosition=0,this.dataView=new DataView(new ArrayBuffer(t))}t.toBN=function(t){switch(typeof t){case"bigint":return new n.BN(t.toString());default:return new n.BN(t)}};var e=t.prototype;return e.shift=function(t){return this.bytePosition+=t,this},e.write8=function(e){return this.dataView.setUint8(this.bytePosition,+t.toBN(e)),this.shift(1)},e.write16=function(e){return this.dataView.setUint16(this.bytePosition,+t.toBN(e),!0),this.shift(2)},e.write32=function(e){return this.dataView.setUint32(this.bytePosition,+t.toBN(e),!0),this.shift(4)},e.write64=function(e){var r=this;return t.toBN(e).toArray("le",8).forEach((function(t){return r.write8(t)})),this},e.write128=function(e){var r=this;return t.toBN(e).toArray("le",16).forEach((function(t){return r.write8(t)})),this},e.writeULEB=function(t){var e=this;return function(t){var e=[],r=0;if(0===t)return[0];for(;t>0;)e[r]=127&t,(t>>=7)&&(e[r]|=128),r+=1;return e}(t).forEach((function(t){return e.write8(t)})),this},e.writeVec=function(t,e){var r=this;return this.writeULEB(t.length),Array.from(t).forEach((function(n,i){return e(r,n,i,t.length)})),this},e.toBytes=function(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))},e.toString=function(t){switch(t){case"base64":return new c(this.toBytes()).toString();case"hex":return new st(this.toBytes()).toString();default:throw new Error("Unsupported encoding, supported values are: base64, hex")}},t}(),Ct=function(){function t(){}return t.set=function(t,e,r){return void 0===r&&(r=1024),this.getTypeInterface(t).encode(e,r)},t.de=function(t,e){return this.getTypeInterface(t).decode(e)},t.hasType=function(t){return this.types.has(t)},t.registerType=function(t,e,r,n){return void 0===n&&(n=function(){return!0}),this.types.set(t,{encode:function(t,e){return void 0===e&&(e=1024),this._encodeRaw(new Ot(e),t)},decode:function(t){return this._decodeRaw(new St(t))},_encodeRaw:function(r,i){if(n(i))return e(r,i);throw new Error("Validation failed for type "+t+", data: "+i)},_decodeRaw:function(t){return r(t)}}),this},t.registerAddressType=function(t,e){return this.registerType(t,(function(t,e){return new st(e).getData().reduce((function(t,e){return t.write8(e)}),t)}),(function(t){return new st(t.readBytes(e)).toString()}))},t.registerVectorType=function(e,r){return this.registerType(e,(function(e,n){return e.writeVec(n,(function(e,n){return t.getTypeInterface(r)._encodeRaw(e,n)}))}),(function(e){return e.readVec((function(e){return t.getTypeInterface(r)._decodeRaw(e)}))}))},t.registerStructType=function(e,r){var n=Object.freeze(r),i=Object.keys(n);return this.registerType(e,(function(e,r){for(var o,u=g(i);!(o=u()).done;){var s=o.value;t.getTypeInterface(n[s])._encodeRaw(e,r[s])}return e}),(function(e){for(var r,o={},u=g(i);!(r=u()).done;){var s=r.value;o[s]=t.getTypeInterface(n[s])._decodeRaw(e)}return o}))},t.registerEnumType=function(e,r){var n=Object.freeze(r),i=Object.keys(n);return this.registerType(e,(function(r,o){var u=Object.keys(o)[0];if(void 0===u)throw new Error("Unknown invariant of the enum "+e);var s=i.indexOf(u);if(-1===s)throw new Error("Unknown invariant of the enum "+e+", allowed values: "+i);var a=n[i[s]];return r.write8(s),null!==a?t.getTypeInterface(a)._encodeRaw(r,o[u]):r}),(function(r){var o,u=r.readULEB(),s=i[u],a=n[s];if(-1===u)throw new Error("Decoding type mismatch, expected enum "+e+" invariant index, received "+u);return(o={})[s]=null===a||t.getTypeInterface(a)._decodeRaw(r),o}))},t.getTypeInterface=function(e){var r=t.types.get(e);if(void 0===r)throw new Error("Type "+e+" is not registered");return r},t}();Ct.U8="u8",Ct.U32="u32",Ct.U64="u64",Ct.U128="u128",Ct.BOOL="bool",Ct.VECTOR="vector",Ct.ADDRESS="address",Ct.STRING="string",Ct.types=new Map,Ct.registerType(Ct.U8,(function(t,e){return t.write8(e)}),(function(t){return t.read8()}),(function(t){return t<256})),Ct.registerType(Ct.U32,(function(t,e){return t.write32(e)}),(function(t){return t.read32()}),(function(t){return t<4294967296})),Ct.registerType(Ct.U64,(function(t,e){return t.write64(e)}),(function(t){return t.read64()}),(function(t){return!0})),Ct.registerType(Ct.U128,(function(t,e){return t.write128(e)}),(function(t){return t.read128()}),(function(t){return!0})),Ct.registerType(Ct.BOOL,(function(t,e){return t.write8(e)}),(function(t){return"1"==t.read8().toString(10)}),(function(t){return!0})),Ct.registerType(Ct.STRING,(function(t,e){return t.writeVec(Array.from(e),(function(t,e){return t.write8(e.charCodeAt(0))}))}),(function(t){return t.readVec((function(t){return t.read8()})).map((function(t){return String.fromCharCode(t)})).join("")}),(function(t){return/^[\x00-\x7F]*$/.test(t)})),exports.BCS={__proto__:null,BcsReader:St,BcsWriter:Ot,BCS:Ct},exports.Base64DataBuffer=c,exports.Coin=At,exports.Ed25519Keypair=p,exports.HexDataBuffer=st,exports.JsonRpcProvider=ut,exports.PUBLIC_KEY_SIZE=32,exports.Provider=h,exports.PublicKey=f,exports.RawSigner=pt,exports.RpcTxnDataSerializer=at,exports.SignerWithProvider=ft,exports.getCoinAfterMerge=function(t){var e;return null==(e=Et(t))?void 0:e.updatedCoin},exports.getCoinAfterSplit=function(t){var e;return null==(e=Tt(t))?void 0:e.updatedCoin},exports.getExecutionStatus=mt,exports.getExecutionStatusError=function(t){return mt(t).error},exports.getExecutionStatusGasSummary=jt,exports.getExecutionStatusType=function(t){return mt(t).status},exports.getMergeCoinResponse=Et,exports.getMoveCallTransaction=function(t){return"Call"in t?t.Call:void 0},exports.getMoveObject=xt,exports.getMoveObjectType=wt,exports.getMovePackageContent=function(t){if("disassembled"in t)return t.disassembled;var e=lt(t);return"package"===(null==e?void 0:e.data.dataType)?e.data.disassembled:void 0},exports.getNewlyCreatedCoinsAfterSplit=function(t){var e;return null==(e=Tt(t))?void 0:e.newCoins},exports.getObjectDeletedResponse=dt,exports.getObjectExistsResponse=lt,exports.getObjectFields=bt,exports.getObjectId=function(t){var e,r;return"objectId"in t?t.objectId:null!=(e=null==(r=gt(t))?void 0:r.objectId)?e:vt(t)},exports.getObjectNotExistsResponse=vt,exports.getObjectOwner=function(t){var e;return null==(e=lt(t))?void 0:e.owner},exports.getObjectPreviousTransactionDigest=function(t){var e;return null==(e=lt(t))?void 0:e.previousTransaction},exports.getObjectReference=gt,exports.getObjectType=function(t){var e;return null==(e=lt(t))?void 0:e.data.dataType},exports.getObjectVersion=function(t){var e;return"version"in t?t.version:null==(e=gt(t))?void 0:e.version},exports.getPublishTransaction=function(t){return"Publish"in t?t.Publish:void 0},exports.getSplitCoinResponse=Tt,exports.getTotalGasUsed=function(t){var e=jt(t);return e.computationCost+e.storageCost-e.storageRebate},exports.getTransactionAuthorityQuorumSignInfo=function(t){return t.authSignInfo},exports.getTransactionData=function(t){return t.data},exports.getTransactionDigest=function(t){return t.transactionDigest},exports.getTransactionEffectsResponse=function(t){return"EffectResponse"in t?t.EffectResponse:void 0},exports.getTransactionGasBudget=function(t){return t.data.gasBudget},exports.getTransactionGasObject=function(t){return t.data.gasPayment},exports.getTransactionKindName=function(t){return Object.keys(t)[0]},exports.getTransactionSender=function(t){return t.data.sender},exports.getTransactionSignature=function(t){return t.txSignature},exports.getTransactions=function(t){return t.data.transactions},exports.getTransferCoinTransaction=function(t){return"TransferCoin"in t?t.TransferCoin:void 0},exports.isAuthorityName=function(t,e){return"string"==typeof t},exports.isAuthorityQuorumSignInfo=V,exports.isAuthoritySignature=function(t,e){return"string"==typeof t},exports.isCertifiedTransaction=M,exports.isEd25519KeypairData=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.publicKey instanceof Uint8Array&&t.secretKey instanceof Uint8Array},exports.isEmptySignInfo=function(t,e){return"object"==typeof t},exports.isEpochId=function(t,e){return"number"==typeof t},exports.isEvent=$,exports.isExecutionStatus=W,exports.isExecutionStatusType=G,exports.isGasCostSummary=K,exports.isGatewayTxSeqNumber=function(t,e){return"number"==typeof t},exports.isGetObjectDataResponse=I,exports.isGetOwnedObjectsResponse=_,exports.isGetTxnDigestsResponse=J,exports.isKeypair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getPublicKey&&"function"==typeof t.signData},exports.isMergeCoinResponse=H,exports.isMergeCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.primaryCoin)&&m(t.coinToMerge)&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isMoveCall=Y,exports.isMoveCallTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.packageObjectId)&&m(t.module)&&m(t.function)&&Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return m(t)}))&&Array.isArray(t.arguments)&&t.arguments.every((function(t){return Q(t)}))&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isMovePackageContent=S,exports.isObjectContentFields=A,exports.isObjectDigest=function(t,e){return"string"==typeof t},exports.isObjectId=function(t,e){return"string"==typeof t},exports.isObjectOwner=j,exports.isObjectStatus=R,exports.isObjectType=P,exports.isOwnedObjectRef=z,exports.isPublicKeyData=x,exports.isPublicKeyInitData=function(t,e){return m(t)||L(t)||t instanceof Buffer||t instanceof Uint8Array||Array.isArray(t)&&t.every((function(t){return L(t)}))||x(t)},exports.isRawAuthoritySignInfo=D,exports.isSequenceNumber=L,exports.isSignaturePubkeyPair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.signature instanceof c&&t.pubKey instanceof f},exports.isSigner=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getAddress&&"function"==typeof t.signData},exports.isSplitCoinResponse=tt,exports.isSplitCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.coinObjectId)&&Array.isArray(t.splitAmounts)&&t.splitAmounts.every((function(t){return L(t)}))&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isSuiAddress=function(t,e){return"string"==typeof t},exports.isSuiData=O,exports.isSuiJsonValue=Q,exports.isSuiMoveObject=C,exports.isSuiMovePackage=k,exports.isSuiObject=B,exports.isSuiObjectInfo=E,exports.isSuiObjectRef=T,exports.isSuiTransactionKind=q,exports.isTransactionBytes=X,exports.isTransactionData=U,exports.isTransactionDigest=m,exports.isTransactionEffects=F,exports.isTransactionEffectsResponse=Z,exports.isTransactionKindName=function(t,e){return"TransferCoin"===t||"Publish"===t||"Call"===t},exports.isTransactionResponse=et,exports.isTransferCoin=N,exports.isTransferCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.objectId)&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)&&m(t.recipient)},exports.isTxnDataSerializer=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.newTransferCoin&&"function"==typeof t.newMoveCall&&"function"==typeof t.newMergeCoin&&"function"==typeof t.newSplitCoin},exports.isValidSuiAddress=yt,exports.isValidSuiObjectId=function(t){return yt(t)},exports.isValidTransactionDigest=function(t){return 32===new c(t).getLength()&&ht.test(t)}; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("tweetnacl")),r=require("buffer"),n=require("bn.js"),i=t(n),o=require("js-sha3"),u=require("util"),s=t(require("jayson/lib/client/browser")),a=t(require("cross-fetch")),c=function(){function t(t){this.data="string"==typeof t?new Uint8Array(r.Buffer.from(t,"base64")):t}var e=t.prototype;return e.getData=function(){return this.data},e.getLength=function(){return this.data.length},e.toString=function(){return r.Buffer.from(this.data).toString("base64")},t}(),f=function(){function t(t){if(function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){var e=r.Buffer.from(t,"base64");if(32!==e.length)throw new Error("Invalid public key input. Expected 32 bytes, got "+e.length);this._bn=new i(e)}else this._bn=new i(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}var e=t.prototype;return e.equals=function(t){return this._bn.eq(t._bn)},e.toBase64=function(){return this.toBuffer().toString("base64")},e.toBytes=function(){return this.toBuffer()},e.toBuffer=function(){var t=this._bn.toArrayLike(r.Buffer);if(32===t.length)return t;var e=r.Buffer.alloc(32);return t.copy(e,32-t.length),e},e.toString=function(){return this.toBase64()},e.toSuiAddress=function(){var t=o.sha3_256(this.toBytes());return new i(t,16).toArray(void 0,32).slice(0,20).reduce((function(t,e){return t+("0"+e.toString(16)).slice(-2)}),"")},t}(),p=function(){function t(t){this.keypair=t||e.sign.keyPair()}t.generate=function(){return new t(e.sign.keyPair())},t.fromSecretKey=function(r,n){var i=e.sign.keyPair.fromSecretKey(r);if(!n||!n.skipValidation){var o=(new u.TextEncoder).encode("sui validation"),s=e.sign.detached(o,i.secretKey);if(!e.sign.detached.verify(o,s,i.publicKey))throw new Error("provided secretKey is invalid")}return new t(i)},t.fromSeed=function(r){return new t(e.sign.keyPair.fromSeed(r))};var r=t.prototype;return r.getPublicKey=function(){return new f(this.keypair.publicKey)},r.signData=function(t){return new c(e.sign.detached(t.getData(),this.keypair.secretKey))},t}(),h=function(){};function y(t,e,r,n,i,o,u){try{var s=t[o](u),a=s.value}catch(t){return void r(t)}s.done?e(a):Promise.resolve(a).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function u(t){y(o,n,i,u,s,"next",t)}function s(t){y(o,n,i,u,s,"throw",t)}u(void 0)}))}}function d(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function v(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var w,b=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",u=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),o=new j(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var s=x(u,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var a=c(t,e,r);if("normal"===a.type){if(n=r.done?"completed":"suspendedYield",a.arg===f)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n="completed",r.method="throw",r.arg=a.arg)}}}(t,r,o),i}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var f={};function p(){}function h(){}function y(){}var l={};s(l,i,(function(){return this}));var d=Object.getPrototypeOf,g=d&&d(d(E([])));g&&g!==e&&r.call(g,i)&&(l=g);var v=y.prototype=p.prototype=Object.create(l);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(i,o){function u(){return new e((function(n,u){!function n(i,o,u,s){var a=c(t[i],t,o);if("throw"!==a.type){var f=a.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(p).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,s)}))}s(a.arg)}(i,o,n,u)}))}return n=n?n.then(u,u):u()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function E(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=y,s(v,"constructor",y),s(y,"constructor",h),h.displayName=s(y,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},w(b.prototype),s(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var u=new b(a(e,r,n,i),o);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},w(v),s(v,u,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),a=r.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(w={exports:{}}),w.exports);function x(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t._bn instanceof n.BN}function m(t,e){return"string"==typeof t}function T(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.AddressOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.ObjectOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.SingleOwner)||"Shared"===t||"Immutable"===t}function j(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.digest)&&m(t.objectId)&&L(t.version)}function E(t,e){return j(t)&&(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type)&&T(t.owner)&&m(t.previousTransaction)}function A(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){return m(t[0])}))}function O(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){var e=t[0];return m(t[1])&&m(e)}))}function S(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&C(t)||(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&k(t)}function C(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type)&&A(t.fields)}function k(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&O(t.disassembled)}function B(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&S(t.data)&&T(t.owner)&&m(t.previousTransaction)&&L(t.storageRebate)&&j(t.reference)}function R(t,e){return"Exists"===t||"NotExists"===t||"Deleted"===t}function P(t,e){return"moveObject"===t||"package"===t}function _(t,e){return Array.isArray(t)&&t.every((function(t){return E(t)}))}function I(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&R(t.status)&&(m(t.details)||j(t.details)||B(t.details))}function L(t,e){return"number"==typeof t}function N(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.recipient)&&j(t.objectRef)}function D(t,e){return Array.isArray(t)&&m(t[0])&&m(t[1])}function q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&N(t.TransferCoin)||(null!==t&&"object"==typeof t||"function"==typeof t)&&k(t.Publish)||(null!==t&&"object"==typeof t||"function"==typeof t)&&$(t.Call)}function U(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.transactions)&&t.transactions.every((function(t){return q(t)}))&&m(t.sender)&&j(t.gasPayment)&&L(t.gasBudget)}function V(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&L(t.epoch)&&Array.isArray(t.signatures)&&t.signatures.every((function(t){return D(t)}))}function M(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.transactionDigest)&&U(t.data)&&m(t.txSignature)&&V(t.authSignInfo)}function K(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&L(t.computationCost)&&L(t.storageCost)&&L(t.storageRebate)}function W(t,e){return"success"===t||"failure"===t}function G(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&W(t.status)&&(void 0===t.error||m(t.error))}function z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&T(t.owner)&&j(t.reference)}function F(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&G(t.status)&&K(t.gasUsed)&&(void 0===t.sharedObjects||Array.isArray(t.sharedObjects)&&t.sharedObjects.every((function(t){return j(t)})))&&m(t.transactionDigest)&&(void 0===t.created||Array.isArray(t.created)&&t.created.every((function(t){return z(t)})))&&(void 0===t.mutated||Array.isArray(t.mutated)&&t.mutated.every((function(t){return z(t)})))&&(void 0===t.unwrapped||Array.isArray(t.unwrapped)&&t.unwrapped.every((function(t){return z(t)})))&&(void 0===t.deleted||Array.isArray(t.deleted)&&t.deleted.every((function(t){return j(t)})))&&(void 0===t.wrapped||Array.isArray(t.wrapped)&&t.wrapped.every((function(t){return j(t)})))&&z(t.gasObject)&&(void 0===t.events||Array.isArray(t.events))&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every((function(t){return m(t)})))}function Z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&F(t.effects)}function J(t,e){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&L(t[0])&&m(t[1])}))}function $(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&j(t.package)&&m(t.module)&&m(t.function)&&(void 0===t.typeArguments||Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return m(t)})))&&(void 0===t.arguments||Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)})))}function Y(t,e){return m(t)||L(t)||!1===t||!0===t||Array.isArray(t)&&t.every((function(t){return m(t)||L(t)||!1===t||!0===t}))}function Q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.txBytes)&&j(t.gas)}function X(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&B(t.updatedCoin)&&B(t.updatedGas)}function H(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&B(t.updatedCoin)&&Array.isArray(t.newCoins)&&t.newCoins.every((function(t){return B(t)}))&&B(t.updatedGas)}function tt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Z(t.EffectResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&H(t.SplitCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&X(t.MergeCoinResponse)}function et(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"2.0"===t.jsonrpc&&m(t.id)}var rt=require("lossless-json"),nt=function(){function t(t,e){this.rpcClient=this.createRpcClient(t,e)}var e=t.prototype;return e.createRpcClient=function(t,e){return new s(function(){var r=l(b.mark((function r(n,i){var o,u,s,c;return b.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o={method:"POST",body:n,headers:Object.assign({"Content-Type":"application/json"},e||{})},r.prev=1,r.next=4,a(t,o);case 4:return u=r.sent,r.next=7,u.text();case 7:s=r.sent,c=JSON.stringify(rt.parse(s,(function(t,e){if(null==e)return e;if("balance"===t)return e.toString();try{if(e.isLosslessNumber)return e.valueOf()}catch(t){return e.toString()}return e}))),u.ok?i(null,c):i(new Error(u.status+" "+u.statusText+": "+s)),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),r.t0 instanceof Error&&i(r.t0);case 15:case"end":return r.stop()}}),r,null,[[1,12]])})));return function(t,e){return r.apply(this,arguments)}}(),{})},e.requestWithType=function(){var t=l(b.mark((function t(e,r,n){var i;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.request(e,r);case 2:if((null===(o=i=t.sent)||"object"!=typeof o)&&"function"!=typeof o||"2.0"!==o.jsonrpc||!m(o.id)||(null===o.error||"object"!=typeof o.error)&&"function"!=typeof o.error||!m(o.error.message)){t.next=7;break}throw new Error("RPC Error: "+i.error.message);case 7:if(!et(i)){t.next=13;break}if(!n(i.result)){t.next=12;break}return t.abrupt("return",i.result);case 12:throw new Error("RPC Error: result not of expected type. Result received was: "+JSON.stringify(i.result));case 13:throw new Error("Unexpected RPC Response: "+i);case 14:case"end":return t.stop()}var o}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.request=function(){var t=l(b.mark((function t(e,r){var n=this;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,i){n.rpcClient.request(e,r,(function(e,r){e?i(e):t(r)}))})));case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e.batchRequestWithType=function(){var t=l(b.mark((function t(e,r){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.batchRequest(e);case 2:return n=t.sent.filter((function(t){return et(t)&&r(t.result)})),t.abrupt("return",n.map((function(t){return t.result})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.batchRequest=function(){var t=l(b.mark((function t(e){var r=this;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){0===e.length&&t([]);var i=e.map((function(t){return r.rpcClient.request(t.method,t.args)}));r.rpcClient.request(i,(function(e,r){e?n(e):t(r)}))})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t}(),it=function(t){return"number"==typeof t},ot=function(t){function e(e){var r;return(r=t.call(this)||this).endpoint=e,r.client=new nt(e),r}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObjectsOwnedByAddress",[e],_);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching owned object: "+t.t0+" for address "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObjectsOwnedByObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObjectsOwnedByObject",[e],_);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching owned object: "+t.t0+" for objectId "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObject",[e],I);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching object info: "+t.t0+" for id "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObjectBatch=function(){var t=l(b.mark((function t(e){var r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{method:"sui_getObject",args:[t]}})),t.prev=1,t.next=4,this.client.batchRequestWithType(r,I);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),new Error("Error fetching object info: "+t.t0+" for id "+e);case 10:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionsForObject=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[{method:"sui_getTransactionsByInputObject",args:[e]},{method:"sui_getTransactionsByMutatedObject",args:[e]}],t.prev=1,t.next=4,this.client.batchRequestWithType(r,J);case 4:return t.abrupt("return",[].concat((n=t.sent)[0],n[1]));case 8:throw t.prev=8,t.t0=t.catch(1),new Error("Error getting transactions for object: "+t.t0+" for id "+e);case 11:case"end":return t.stop()}}),t,this,[[1,8]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionsForAddress=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[{method:"sui_getTransactionsToAddress",args:[e]},{method:"sui_getTransactionsFromAddress",args:[e]}],t.prev=1,t.next=4,this.client.batchRequestWithType(r,J);case 4:return t.abrupt("return",[].concat((n=t.sent)[0],n[1]));case 8:throw t.prev=8,t.t0=t.catch(1),new Error("Error getting transactions for address: "+t.t0+" for id "+e);case 11:case"end":return t.stop()}}),t,this,[[1,8]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffects=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransaction",[e],Z);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error getting transaction with effects: "+t.t0+" for digest "+e);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffectsBatch=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{method:"sui_getTransaction",args:[t]}})),t.prev=1,t.next=4,this.client.batchRequestWithType(r,Z);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),n=e.join(", ").substring(0,-2),new Error("Error getting transaction effects: "+t.t0+" for digests ["+n+"]");case 11:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=l(b.mark((function t(e,r,n){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_executeTransaction",[e,r,n],tt);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error executing transaction: "+t.t0+"}");case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getTotalTransactionNumber=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTotalTransactionNumber",[],it);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error fetching total transaction number: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(){return t.apply(this,arguments)}}(),r.getTransactionDigestsInRange=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransactionsInRange",[e,r],J);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching transaction digests in range: "+t.t0+" for range "+e+"-"+r);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}(),r.getRecentTransactions=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getRecentTransactions",[e],J);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching recent transactions: "+t.t0+" for count "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),e}(h),ut=function(){function t(t){this._data="string"==typeof t?new Uint8Array(r.Buffer.from(t,"hex")):t}var e=t.prototype;return e.getData=function(){return this._data},e.getLength=function(){return this._data.length},e.toString=function(){return r.Buffer.from(this._data).toString("hex")},t}(),st=function(){function t(t){this.client=new nt(t)}var e=t.prototype;return e.newTransferCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_transferCoin",[e,r.objectId,r.gasPayment,r.gasBudget,r.recipient],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error transferring coin: "+t.t0+" with args "+r);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newMoveCall=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_moveCall",[e,r.packageObjectId,r.module,r.function,r.typeArguments,r.arguments,r.gasPayment,r.gasBudget],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error executing a move call: "+t.t0+" with args "+r);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newMergeCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_mergeCoins",[e,r.primaryCoin,r.coinToMerge,r.gasPayment,r.gasBudget],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error merging coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newSplitCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_splitCoin",[e,r.coinObjectId,r.splitAmounts,r.gasPayment,r.gasBudget],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error splitting coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),t}(),at=function(t){function e(){return t.apply(this,arguments)||this}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getOwnedObjects");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getObject");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getTransaction=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTransaction");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=l(b.mark((function t(e,r,n){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("executeTransaction");case 1:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getTotalTransactionNumber=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTotalTransactionNumber");case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getTransactionDigestsInRange=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTransactionDigestsInRange");case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getRecentTransactions=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getRecentTransactions");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.newError=function(t){return new Error("Please use a valid provider for "+t)},e}(h),ct=function(){function t(t,e){this.provider=t||new at;var r="";this.provider instanceof ot&&(r=this.provider.endpoint),this.serializer=e||new st(r)}var e=t.prototype;return e.signAndExecuteTransaction=function(){var t=l(b.mark((function t(e){var r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.signData(e);case 2:return r=t.sent,t.next=5,this.provider.executeTransaction(e.toString(),r.signature.toString(),r.pubKey.toString());case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.transferCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newTransferCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.mergeCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newMergeCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.splitCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newSplitCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.executeMoveCall=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newMoveCall(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),ft=function(t){function e(e,r,n){var i;return(i=t.call(this,r,n)||this).keypair=e,i}d(e,t);var r=e.prototype;return r.getAddress=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.keypair.getPublicKey().toSuiAddress());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.signData=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{signature:this.keypair.signData(e),pubKey:this.keypair.getPublicKey()});case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.connect=function(t){return new e(this.keypair,t)},e}(ct),pt=/^(?:[a-zA-Z0-9+\/]{4})*(?:|(?:[a-zA-Z0-9+\/]{3}=)|(?:[a-zA-Z0-9+\/]{2}==)|(?:[a-zA-Z0-9+\/]{1}===))$/;function ht(t){return function(t){return/^(0x|0X)?[a-fA-F0-9]+$/.test(t)&&t.length%2==0}(t)&&20===function(t){return/^(0x|0X)/.test(t)?(t.length-2)/2:t.length/2}(t)}function yt(t){return"Exists"!==t.status?void 0:t.details}function lt(t){return"Deleted"!==t.status?void 0:t.details}function dt(t){return"NotExists"!==t.status?void 0:t.details}function gt(t){var e;return(null==(e=yt(t))?void 0:e.reference)||lt(t)}function vt(t){var e;return null==(e=bt(t))?void 0:e.type}function wt(t){var e;return null==(e=bt(t))?void 0:e.fields}function bt(t){var e="data"in t?t:yt(t);if("moveObject"===(null==e?void 0:e.data.dataType))return e.data}function xt(t){return t.effects.status}function mt(t){return t.effects.gasUsed}function Tt(t){return"SplitCoinResponse"in t?t.SplitCoinResponse:void 0}function jt(t){return"MergeCoinResponse"in t?t.MergeCoinResponse:void 0}var Et=function(){function t(){}return t.isCoin=function(t){var e,r;return null!=(e=null==(r=vt(t))?void 0:r.startsWith("0x2::coin::Coin"))&&e},t.getBalance=function(e){var r;if(t.isCoin(e)){var n=null==(r=wt(e))?void 0:r.balance;return new i.BN(n,10)}},t.getZero=function(){return new i.BN("0",10)},t}(),At=function(){function t(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}var e=t.prototype;return e.shift=function(t){return this.bytePosition+=t,this},e.read8=function(){var t=this.dataView.getUint8(this.bytePosition);return this.shift(1),new n.BN(t,10)},e.read16=function(){var t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),new n.BN(t,10)},e.read32=function(){var t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),new n.BN(t,10)},e.read64=function(){var t=this.read32(),e=this.read32().toString(16)+t.toString(16).padStart(8,"0");return new n.BN(e,16)},e.read128=function(){var t=this.read64(),e=this.read64().toString(16)+t.toString(16).padStart(8,"0");return new n.BN(e,16)},e.readBytes=function(t){var e=new Uint8Array(this.dataView.buffer,this.bytePosition+this.dataView.byteOffset,t);return this.shift(t),e},e.readULEB=function(){var t=function(t){for(var e=0,r=0,n=0;;){var i=t[n];if(n+=1,e|=(127&i)<<r,0==(128&i))break;r+=7}return{value:e,length:n}}(new Uint8Array(this.dataView.buffer,this.bytePosition+this.dataView.byteOffset)),e=t.value;return this.shift(t.length),e},e.readVec=function(t){for(var e=this.readULEB(),r=[],n=0;n<e;n++)r.push(t(this,n,e));return r},t}(),Ot=function(){function t(t){void 0===t&&(t=1024),this.bytePosition=0,this.dataView=new DataView(new ArrayBuffer(t))}t.toBN=function(t){switch(typeof t){case"bigint":return new n.BN(t.toString());default:return new n.BN(t)}};var e=t.prototype;return e.shift=function(t){return this.bytePosition+=t,this},e.write8=function(e){return this.dataView.setUint8(this.bytePosition,+t.toBN(e)),this.shift(1)},e.write16=function(e){return this.dataView.setUint16(this.bytePosition,+t.toBN(e),!0),this.shift(2)},e.write32=function(e){return this.dataView.setUint32(this.bytePosition,+t.toBN(e),!0),this.shift(4)},e.write64=function(e){var r=this;return t.toBN(e).toArray("le",8).forEach((function(t){return r.write8(t)})),this},e.write128=function(e){var r=this;return t.toBN(e).toArray("le",16).forEach((function(t){return r.write8(t)})),this},e.writeULEB=function(t){var e=this;return function(t){var e=[],r=0;if(0===t)return[0];for(;t>0;)e[r]=127&t,(t>>=7)&&(e[r]|=128),r+=1;return e}(t).forEach((function(t){return e.write8(t)})),this},e.writeVec=function(t,e){var r=this;return this.writeULEB(t.length),Array.from(t).forEach((function(n,i){return e(r,n,i,t.length)})),this},e.toBytes=function(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))},e.toString=function(t){switch(t){case"base64":return new c(this.toBytes()).toString();case"hex":return new ut(this.toBytes()).toString();default:throw new Error("Unsupported encoding, supported values are: base64, hex")}},t}(),St=function(){function t(){}return t.set=function(t,e,r){return void 0===r&&(r=1024),this.getTypeInterface(t).encode(e,r)},t.de=function(t,e){return this.getTypeInterface(t).decode(e)},t.hasType=function(t){return this.types.has(t)},t.registerType=function(t,e,r,n){return void 0===n&&(n=function(){return!0}),this.types.set(t,{encode:function(t,e){return void 0===e&&(e=1024),this._encodeRaw(new Ot(e),t)},decode:function(t){return this._decodeRaw(new At(t))},_encodeRaw:function(r,i){if(n(i))return e(r,i);throw new Error("Validation failed for type "+t+", data: "+i)},_decodeRaw:function(t){return r(t)}}),this},t.registerAddressType=function(t,e){return this.registerType(t,(function(t,e){return new ut(e).getData().reduce((function(t,e){return t.write8(e)}),t)}),(function(t){return new ut(t.readBytes(e)).toString()}))},t.registerVectorType=function(e,r){return this.registerType(e,(function(e,n){return e.writeVec(n,(function(e,n){return t.getTypeInterface(r)._encodeRaw(e,n)}))}),(function(e){return e.readVec((function(e){return t.getTypeInterface(r)._decodeRaw(e)}))}))},t.registerStructType=function(e,r){var n=Object.freeze(r),i=Object.keys(n);return this.registerType(e,(function(e,r){for(var o,u=v(i);!(o=u()).done;){var s=o.value;t.getTypeInterface(n[s])._encodeRaw(e,r[s])}return e}),(function(e){for(var r,o={},u=v(i);!(r=u()).done;){var s=r.value;o[s]=t.getTypeInterface(n[s])._decodeRaw(e)}return o}))},t.registerEnumType=function(e,r){var n=Object.freeze(r),i=Object.keys(n);return this.registerType(e,(function(r,o){var u=Object.keys(o)[0];if(void 0===u)throw new Error("Unknown invariant of the enum "+e);var s=i.indexOf(u);if(-1===s)throw new Error("Unknown invariant of the enum "+e+", allowed values: "+i);var a=n[i[s]];return r.write8(s),null!==a?t.getTypeInterface(a)._encodeRaw(r,o[u]):r}),(function(r){var o,u=r.readULEB(),s=i[u],a=n[s];if(-1===u)throw new Error("Decoding type mismatch, expected enum "+e+" invariant index, received "+u);return(o={})[s]=null===a||t.getTypeInterface(a)._decodeRaw(r),o}))},t.getTypeInterface=function(e){var r=t.types.get(e);if(void 0===r)throw new Error("Type "+e+" is not registered");return r},t}();St.U8="u8",St.U32="u32",St.U64="u64",St.U128="u128",St.BOOL="bool",St.VECTOR="vector",St.ADDRESS="address",St.STRING="string",St.types=new Map,St.registerType(St.U8,(function(t,e){return t.write8(e)}),(function(t){return t.read8()}),(function(t){return t<256})),St.registerType(St.U32,(function(t,e){return t.write32(e)}),(function(t){return t.read32()}),(function(t){return t<4294967296})),St.registerType(St.U64,(function(t,e){return t.write64(e)}),(function(t){return t.read64()}),(function(t){return!0})),St.registerType(St.U128,(function(t,e){return t.write128(e)}),(function(t){return t.read128()}),(function(t){return!0})),St.registerType(St.BOOL,(function(t,e){return t.write8(e)}),(function(t){return"1"==t.read8().toString(10)}),(function(t){return!0})),St.registerType(St.STRING,(function(t,e){return t.writeVec(Array.from(e),(function(t,e){return t.write8(e.charCodeAt(0))}))}),(function(t){return t.readVec((function(t){return t.read8()})).map((function(t){return String.fromCharCode(t)})).join("")}),(function(t){return/^[\x00-\x7F]*$/.test(t)})),exports.BCS={__proto__:null,BcsReader:At,BcsWriter:Ot,BCS:St},exports.Base64DataBuffer=c,exports.Coin=Et,exports.Ed25519Keypair=p,exports.HexDataBuffer=ut,exports.JsonRpcProvider=ot,exports.PUBLIC_KEY_SIZE=32,exports.Provider=h,exports.PublicKey=f,exports.RawSigner=ft,exports.RpcTxnDataSerializer=st,exports.SignerWithProvider=ct,exports.getCoinAfterMerge=function(t){var e;return null==(e=jt(t))?void 0:e.updatedCoin},exports.getCoinAfterSplit=function(t){var e;return null==(e=Tt(t))?void 0:e.updatedCoin},exports.getExecutionStatus=xt,exports.getExecutionStatusError=function(t){return xt(t).error},exports.getExecutionStatusGasSummary=mt,exports.getExecutionStatusType=function(t){return xt(t).status},exports.getMergeCoinResponse=jt,exports.getMoveCallTransaction=function(t){return"Call"in t?t.Call:void 0},exports.getMoveObject=bt,exports.getMoveObjectType=vt,exports.getMovePackageContent=function(t){if("disassembled"in t)return t.disassembled;var e=yt(t);return"package"===(null==e?void 0:e.data.dataType)?e.data.disassembled:void 0},exports.getNewlyCreatedCoinsAfterSplit=function(t){var e;return null==(e=Tt(t))?void 0:e.newCoins},exports.getObjectDeletedResponse=lt,exports.getObjectExistsResponse=yt,exports.getObjectFields=wt,exports.getObjectId=function(t){var e,r;return"objectId"in t?t.objectId:null!=(e=null==(r=gt(t))?void 0:r.objectId)?e:dt(t)},exports.getObjectNotExistsResponse=dt,exports.getObjectOwner=function(t){var e;return null==(e=yt(t))?void 0:e.owner},exports.getObjectPreviousTransactionDigest=function(t){var e;return null==(e=yt(t))?void 0:e.previousTransaction},exports.getObjectReference=gt,exports.getObjectType=function(t){var e;return null==(e=yt(t))?void 0:e.data.dataType},exports.getObjectVersion=function(t){var e;return"version"in t?t.version:null==(e=gt(t))?void 0:e.version},exports.getPublishTransaction=function(t){return"Publish"in t?t.Publish:void 0},exports.getSplitCoinResponse=Tt,exports.getTotalGasUsed=function(t){var e=mt(t);return e.computationCost+e.storageCost-e.storageRebate},exports.getTransactionAuthorityQuorumSignInfo=function(t){return t.authSignInfo},exports.getTransactionData=function(t){return t.data},exports.getTransactionDigest=function(t){return t.transactionDigest},exports.getTransactionEffectsResponse=function(t){return"EffectResponse"in t?t.EffectResponse:void 0},exports.getTransactionGasBudget=function(t){return t.data.gasBudget},exports.getTransactionGasObject=function(t){return t.data.gasPayment},exports.getTransactionKindName=function(t){return Object.keys(t)[0]},exports.getTransactionSender=function(t){return t.data.sender},exports.getTransactionSignature=function(t){return t.txSignature},exports.getTransactions=function(t){return t.data.transactions},exports.getTransferCoinTransaction=function(t){return"TransferCoin"in t?t.TransferCoin:void 0},exports.isAuthorityName=function(t,e){return"string"==typeof t},exports.isAuthorityQuorumSignInfo=V,exports.isAuthoritySignature=function(t,e){return"string"==typeof t},exports.isCertifiedTransaction=M,exports.isEd25519KeypairData=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.publicKey instanceof Uint8Array&&t.secretKey instanceof Uint8Array},exports.isEmptySignInfo=function(t,e){return"object"==typeof t},exports.isEpochId=function(t,e){return"number"==typeof t},exports.isExecutionStatus=G,exports.isExecutionStatusType=W,exports.isGasCostSummary=K,exports.isGatewayTxSeqNumber=function(t,e){return"number"==typeof t},exports.isGetObjectDataResponse=I,exports.isGetOwnedObjectsResponse=_,exports.isGetTxnDigestsResponse=J,exports.isKeypair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getPublicKey&&"function"==typeof t.signData},exports.isMergeCoinResponse=X,exports.isMergeCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.primaryCoin)&&m(t.coinToMerge)&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isMoveCall=$,exports.isMoveCallTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.packageObjectId)&&m(t.module)&&m(t.function)&&Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return m(t)}))&&Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)}))&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isMovePackageContent=O,exports.isObjectContentFields=A,exports.isObjectDigest=function(t,e){return"string"==typeof t},exports.isObjectId=function(t,e){return"string"==typeof t},exports.isObjectOwner=T,exports.isObjectStatus=R,exports.isObjectType=P,exports.isOwnedObjectRef=z,exports.isPublicKeyData=x,exports.isPublicKeyInitData=function(t,e){return m(t)||L(t)||t instanceof Buffer||t instanceof Uint8Array||Array.isArray(t)&&t.every((function(t){return L(t)}))||x(t)},exports.isRawAuthoritySignInfo=D,exports.isSequenceNumber=L,exports.isSignaturePubkeyPair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.signature instanceof c&&t.pubKey instanceof f},exports.isSigner=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getAddress&&"function"==typeof t.signData},exports.isSplitCoinResponse=H,exports.isSplitCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.coinObjectId)&&Array.isArray(t.splitAmounts)&&t.splitAmounts.every((function(t){return L(t)}))&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isSuiAddress=function(t,e){return"string"==typeof t},exports.isSuiData=S,exports.isSuiJsonValue=Y,exports.isSuiMoveObject=C,exports.isSuiMovePackage=k,exports.isSuiObject=B,exports.isSuiObjectInfo=E,exports.isSuiObjectRef=j,exports.isSuiTransactionKind=q,exports.isTransactionBytes=Q,exports.isTransactionData=U,exports.isTransactionDigest=m,exports.isTransactionEffects=F,exports.isTransactionEffectsResponse=Z,exports.isTransactionKindName=function(t,e){return"TransferCoin"===t||"Publish"===t||"Call"===t},exports.isTransactionResponse=tt,exports.isTransferCoin=N,exports.isTransferCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.objectId)&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)&&m(t.recipient)},exports.isTxnDataSerializer=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.newTransferCoin&&"function"==typeof t.newMoveCall&&"function"==typeof t.newMergeCoin&&"function"==typeof t.newSplitCoin},exports.isValidSuiAddress=ht,exports.isValidSuiObjectId=function(t){return ht(t)},exports.isValidTransactionDigest=function(t){return 32===new c(t).getLength()&&pt.test(t)}; | ||
//# sourceMappingURL=sui.js.cjs.production.min.js.map |
@@ -8,2 +8,4 @@ /** Base64 string representing the object digest */ | ||
ObjectOwner: SuiAddress; | ||
} | { | ||
SingleOwner: SuiAddress; | ||
} | 'Shared' | 'Immutable'; | ||
@@ -10,0 +12,0 @@ export declare function isValidTransactionDigest(value: string): value is TransactionDigest; |
import { GetObjectDataResponse } from './objects'; | ||
import BN from 'bn.js'; | ||
/** | ||
* Utility class for 0x2::Coin | ||
* Utility class for 0x2::coin | ||
* as defined in https://github.com/MystenLabs/sui/blob/ca9046fd8b1a9e8634a4b74b0e7dabdc7ea54475/sui_programmability/framework/sources/Coin.move#L4 | ||
@@ -6,0 +6,0 @@ */ |
@@ -22,3 +22,3 @@ import { ObjectOwner } from './common'; | ||
export declare type SuiMoveObject = { | ||
/** Move type (e.g., "0x2::Coin::Coin<0x2::SUI::SUI>") */ | ||
/** Move type (e.g., "0x2::coin::Coin<0x2::sui::SUI>") */ | ||
type: string; | ||
@@ -25,0 +25,0 @@ /** Fields and values stored inside the Move object */ |
@@ -41,3 +41,2 @@ import { ObjectOwner, SuiAddress, TransactionDigest } from './common'; | ||
status: ExecutionStatusType; | ||
gas_cost: GasCostSummary; | ||
error?: string; | ||
@@ -52,2 +51,3 @@ }; | ||
status: ExecutionStatus; | ||
gasUsed: GasCostSummary; | ||
/** The object references of the shared objects used in this transaction. Empty if no shared objects were used. */ | ||
@@ -77,3 +77,3 @@ sharedObjects?: SuiObjectRef[]; | ||
/** The events emitted during execution. Note that only successful transactions emit events */ | ||
events?: Event[]; | ||
events?: any[]; | ||
/** The set of transaction digests this transaction depends on */ | ||
@@ -88,6 +88,2 @@ dependencies?: TransactionDigest[]; | ||
export declare type GetTxnDigestsResponse = [GatewayTxSeqNumber, TransactionDigest][]; | ||
export declare type Event = { | ||
type_: string; | ||
contents: any; | ||
}; | ||
export declare type MoveCall = { | ||
@@ -94,0 +90,0 @@ package: SuiObjectRef; |
{ | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"license": "Apache-2.0", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -73,3 +73,3 @@ # Sui TypeScript SDK | ||
To transfer a `0x2::Coin::Coin<SUI>`: | ||
To transfer a `0x2::coin::Coin<SUI>`: | ||
@@ -92,3 +92,3 @@ ```typescript | ||
To split a `0x2::Coin::Coin<SUI>` into multiple coins | ||
To split a `0x2::coin::Coin<SUI>` into multiple coins | ||
@@ -144,3 +144,3 @@ ```typescript | ||
packageObjectId: '0x2', | ||
module: 'DevNetNFT', | ||
module: 'devnet_nft', | ||
function: 'mint', | ||
@@ -147,0 +147,0 @@ typeArguments: [], |
@@ -8,3 +8,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
*/ | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferCoinTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferCoin, RawAuthoritySignInfo, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, Event, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index"; | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferCoinTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferCoin, RawAuthoritySignInfo, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index"; | ||
import { BN } from "bn.js"; | ||
@@ -175,2 +175,6 @@ import { Base64DataBuffer } from "./serialization/base64"; | ||
isTransactionDigest(obj.ObjectOwner) as boolean || | ||
(obj !== null && | ||
typeof obj === "object" || | ||
typeof obj === "function") && | ||
isTransactionDigest(obj.SingleOwner) as boolean || | ||
obj === "Shared" || | ||
@@ -439,3 +443,2 @@ obj === "Immutable") | ||
isExecutionStatusType(obj.status) as boolean && | ||
isGasCostSummary(obj.gas_cost) as boolean && | ||
(typeof obj.error === "undefined" || | ||
@@ -462,2 +465,3 @@ isTransactionDigest(obj.error) as boolean) | ||
isExecutionStatus(obj.status) as boolean && | ||
isGasCostSummary(obj.gasUsed) as boolean && | ||
(typeof obj.sharedObjects === "undefined" || | ||
@@ -496,6 +500,3 @@ Array.isArray(obj.sharedObjects) && | ||
(typeof obj.events === "undefined" || | ||
Array.isArray(obj.events) && | ||
obj.events.every((e: any) => | ||
isEvent(e) as boolean | ||
)) && | ||
Array.isArray(obj.events)) && | ||
(typeof obj.dependencies === "undefined" || | ||
@@ -536,11 +537,2 @@ Array.isArray(obj.dependencies) && | ||
export function isEvent(obj: any, _argumentName?: string): obj is Event { | ||
return ( | ||
(obj !== null && | ||
typeof obj === "object" || | ||
typeof obj === "function") && | ||
isTransactionDigest(obj.type_) as boolean | ||
) | ||
} | ||
export function isMoveCall(obj: any, _argumentName?: string): obj is MoveCall { | ||
@@ -547,0 +539,0 @@ return ( |
@@ -95,2 +95,57 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
// Transactions | ||
async getTransactionsForObject( | ||
objectID: string | ||
): Promise<GetTxnDigestsResponse> { | ||
const requests = [ | ||
{ | ||
method: 'sui_getTransactionsByInputObject', | ||
args: [objectID], | ||
}, | ||
{ | ||
method: 'sui_getTransactionsByMutatedObject', | ||
args: [objectID], | ||
}, | ||
]; | ||
try { | ||
const results = await this.client.batchRequestWithType( | ||
requests, | ||
isGetTxnDigestsResponse | ||
); | ||
return [...results[0], ...results[1]]; | ||
} catch (err) { | ||
throw new Error( | ||
`Error getting transactions for object: ${err} for id ${objectID}` | ||
); | ||
} | ||
} | ||
async getTransactionsForAddress( | ||
addressID: string | ||
): Promise<GetTxnDigestsResponse> { | ||
const requests = [ | ||
{ | ||
method: 'sui_getTransactionsToAddress', | ||
args: [addressID], | ||
}, | ||
{ | ||
method: 'sui_getTransactionsFromAddress', | ||
args: [addressID], | ||
}, | ||
]; | ||
try { | ||
const results = await this.client.batchRequestWithType( | ||
requests, | ||
isGetTxnDigestsResponse | ||
); | ||
return [...results[0], ...results[1]]; | ||
} catch (err) { | ||
throw new Error( | ||
`Error getting transactions for address: ${err} for id ${addressID}` | ||
); | ||
} | ||
} | ||
async getTransactionWithEffects( | ||
@@ -97,0 +152,0 @@ digest: TransactionDigest |
@@ -49,12 +49,16 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
const text = await res.text(); | ||
const result = JSON.stringify(LosslessJSON.parse(text, (key : string, value : any) => { | ||
if (key === "balance") return value.toString(); | ||
try { | ||
if (value.isLosslessNumber) return value.valueOf(); | ||
} catch { | ||
return value.toString(); | ||
} | ||
return value; | ||
} | ||
)); | ||
const result = JSON.stringify( | ||
LosslessJSON.parse(text, (key: string, value: any) => { | ||
if (value == null) { | ||
return value; | ||
} | ||
if (key === 'balance') return value.toString(); | ||
try { | ||
if (value.isLosslessNumber) return value.valueOf(); | ||
} catch { | ||
return value.toString(); | ||
} | ||
return value; | ||
}) | ||
); | ||
if (res.ok) { | ||
@@ -61,0 +65,0 @@ callback(null, result); |
@@ -12,2 +12,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
| { ObjectOwner: SuiAddress } | ||
| { SingleOwner: SuiAddress } | ||
| 'Shared' | ||
@@ -14,0 +15,0 @@ | 'Immutable'; |
@@ -11,3 +11,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
/** | ||
* Utility class for 0x2::Coin | ||
* Utility class for 0x2::coin | ||
* as defined in https://github.com/MystenLabs/sui/blob/ca9046fd8b1a9e8634a4b74b0e7dabdc7ea54475/sui_programmability/framework/sources/Coin.move#L4 | ||
@@ -17,3 +17,3 @@ */ | ||
static isCoin(data: GetObjectDataResponse): boolean { | ||
return getMoveObjectType(data)?.startsWith('0x2::Coin::Coin') ?? false; | ||
return getMoveObjectType(data)?.startsWith('0x2::coin::Coin') ?? false; | ||
} | ||
@@ -20,0 +20,0 @@ |
@@ -32,3 +32,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
export type SuiMoveObject = { | ||
/** Move type (e.g., "0x2::Coin::Coin<0x2::SUI::SUI>") */ | ||
/** Move type (e.g., "0x2::coin::Coin<0x2::sui::SUI>") */ | ||
type: string; | ||
@@ -35,0 +35,0 @@ /** Fields and values stored inside the Move object */ |
@@ -49,3 +49,2 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
status: ExecutionStatusType; | ||
gas_cost: GasCostSummary; | ||
error?: string; | ||
@@ -63,2 +62,3 @@ }; | ||
status: ExecutionStatus; | ||
gasUsed: GasCostSummary; | ||
/** The object references of the shared objects used in this transaction. Empty if no shared objects were used. */ | ||
@@ -88,3 +88,4 @@ sharedObjects?: SuiObjectRef[]; | ||
/** The events emitted during execution. Note that only successful transactions emit events */ | ||
events?: Event[]; | ||
// TODO: properly define type when this is being used | ||
events?: any[]; | ||
/** The set of transaction digests this transaction depends on */ | ||
@@ -103,7 +104,2 @@ dependencies?: TransactionDigest[]; | ||
export type Event = { | ||
type_: string; | ||
contents: any; | ||
}; | ||
export type MoveCall = { | ||
@@ -252,3 +248,3 @@ package: SuiObjectRef; | ||
): GasCostSummary { | ||
return getExecutionStatus(data).gas_cost; | ||
return data.effects.gasUsed; | ||
} | ||
@@ -255,0 +251,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1014777
10674