@mysten/sui.js
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -1,2 +0,2 @@ | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferObjectTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, PublishTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferObject, SuiTransferSui, SuiChangeEpoch, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, PublishResponse, SuiPackage, TransactionResponse } from "./index"; | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferObjectTransaction, TransferSuiTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, PublishTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferObject, SuiTransferSui, SuiChangeEpoch, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, PublishResponse, SuiPackage, TransactionResponse } from "./index"; | ||
export declare function isEd25519KeypairData(obj: any, _argumentName?: string): obj is Ed25519KeypairData; | ||
@@ -7,2 +7,3 @@ export declare function isKeypair(obj: any, _argumentName?: string): obj is Keypair; | ||
export declare function isTransferObjectTransaction(obj: any, _argumentName?: string): obj is TransferObjectTransaction; | ||
export declare function isTransferSuiTransaction(obj: any, _argumentName?: string): obj is TransferSuiTransaction; | ||
export declare function isMergeCoinTransaction(obj: any, _argumentName?: string): obj is MergeCoinTransaction; | ||
@@ -9,0 +10,0 @@ export declare function isSplitCoinTransaction(obj: any, _argumentName?: string): obj is SplitCoinTransaction; |
@@ -5,3 +5,3 @@ import { Provider } from '../providers/provider'; | ||
import { SignaturePubkeyPair, Signer } from './signer'; | ||
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferObjectTransaction, TxnDataSerializer, PublishTransaction } from './txn-data-serializers/txn-data-serializer'; | ||
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferObjectTransaction, TransferSuiTransaction, TxnDataSerializer, PublishTransaction } from './txn-data-serializers/txn-data-serializer'; | ||
export declare abstract class SignerWithProvider implements Signer { | ||
@@ -28,2 +28,6 @@ readonly provider: Provider; | ||
/** | ||
* Serialize and Sign a `TransferSui` transaction and submit to the Gateway for execution | ||
*/ | ||
transferSui(transaction: TransferSuiTransaction): Promise<TransactionResponse>; | ||
/** | ||
* Serialize and Sign a `MergeCoin` transaction and submit to the Gateway for execution | ||
@@ -30,0 +34,0 @@ */ |
import { Base64DataBuffer } from '../../serialization/base64'; | ||
import { SuiAddress } from '../../types'; | ||
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferObjectTransaction, PublishTransaction, TxnDataSerializer } from './txn-data-serializer'; | ||
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferObjectTransaction, TransferSuiTransaction, PublishTransaction, TxnDataSerializer } from './txn-data-serializer'; | ||
/** | ||
@@ -20,2 +20,3 @@ * This is a temporary implementation of the `TxnDataSerializer` class | ||
newTransferObject(signerAddress: SuiAddress, t: TransferObjectTransaction): Promise<Base64DataBuffer>; | ||
newTransferSui(signerAddress: SuiAddress, t: TransferSuiTransaction): Promise<Base64DataBuffer>; | ||
newMoveCall(signerAddress: SuiAddress, t: MoveCallTransaction): Promise<Base64DataBuffer>; | ||
@@ -22,0 +23,0 @@ newMergeCoin(signerAddress: SuiAddress, t: MergeCoinTransaction): Promise<Base64DataBuffer>; |
@@ -9,2 +9,8 @@ import { Base64DataBuffer } from '../../serialization/base64'; | ||
} | ||
export interface TransferSuiTransaction { | ||
suiObjectId: ObjectId; | ||
gasBudget: number; | ||
recipient: SuiAddress; | ||
amount?: number; | ||
} | ||
export interface MergeCoinTransaction { | ||
@@ -41,2 +47,3 @@ primaryCoin: ObjectId; | ||
newTransferObject(signerAddress: SuiAddress, txn: TransferObjectTransaction): Promise<Base64DataBuffer>; | ||
newTransferSui(signerAddress: SuiAddress, txn: TransferSuiTransaction): Promise<Base64DataBuffer>; | ||
newMoveCall(signerAddress: SuiAddress, txn: MoveCallTransaction): Promise<Base64DataBuffer>; | ||
@@ -43,0 +50,0 @@ newMergeCoin(signerAddress: SuiAddress, txn: MergeCoinTransaction): Promise<Base64DataBuffer>; |
@@ -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"),o=t(n),i=require("js-sha3"),s=require("util"),u=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 o(e)}else this._bn=new o(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=i.sha3_256(this.toBytes());return new o(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 o=e.sign.keyPair.fromSecretKey(r);if(!n||!n.skipValidation){var i=(new s.TextEncoder).encode("sui validation"),u=e.sign.detached(i,o.secretKey);if(!e.sign.detached.verify(i,u,o.publicKey))throw new Error("provided secretKey is invalid")}return new t(o)},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}(),l=function(){};function h(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function y(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){h(i,n,o,s,u,"next",t)}function u(t){h(i,n,o,s,u,"throw",t)}s(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)}var g,v=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new T(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var u=w(s,r);if(u){if(u===f)continue;return u}}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,i),o}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 l(){}function h(){}var y={};u(y,o,(function(){return this}));var d=Object.getPrototypeOf,g=d&&d(d(E([])));g&&g!==e&&r.call(g,o)&&(y=g);var v=h.prototype=p.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;this._invoke=function(o,i){function s(){return new e((function(n,s){!function n(o,i,s,u){var a=c(t[o],t,i);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,s,u)}),(function(t){n("throw",t,s,u)})):e.resolve(p).then((function(t){f.value=t,s(f)}),(function(t){return n("throw",t,s,u)}))}u(a.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function w(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,w(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 o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(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[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=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 i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return l.prototype=h,u(v,"constructor",h),u(h,"constructor",l),l.displayName=u(h,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,s,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new x(a(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},b(v),u(v,s,"Generator"),u(v,o,(function(){return this})),u(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,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 s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),a=r.call(i,"finallyLoc");if(u&&a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(s)},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 o=n.arg;j(r)}return o}}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)}}(g={exports:{}}),g.exports);function b(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t._bn instanceof n.BN}function x(t,e){return"string"==typeof t}function w(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.AddressOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.ObjectOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.SingleOwner)||"Shared"===t||"Immutable"===t}function m(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.digest)&&x(t.objectId)&&B(t.version)}function j(t,e){return m(t)&&(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.type)&&w(t.owner)&&x(t.previousTransaction)}function T(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){return x(t[0])}))}function E(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){var e=t[0];return x(t[1])&&x(e)}))}function O(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&A(t)||(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&S(t)}function A(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.type)&&T(t.fields)&&"boolean"==typeof t.has_public_transfer}function S(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&E(t.disassembled)}function k(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&O(t.data)&&w(t.owner)&&x(t.previousTransaction)&&B(t.storageRebate)&&m(t.reference)}function C(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 j(t)}))}function R(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&C(t.status)&&(x(t.details)||m(t.details)||k(t.details))}function B(t,e){return"number"==typeof t}function q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.recipient)&&m(t.objectRef)}function I(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.recipient)&&(null===t.amount||B(t.amount))}function D(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.epoch)&&B(t.storage_charge)&&B(t.computation_charge)}function L(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&q(t.TransferObject)||(null!==t&&"object"==typeof t||"function"==typeof t)&&S(t.Publish)||(null!==t&&"object"==typeof t||"function"==typeof t)&&J(t.Call)||(null!==t&&"object"==typeof t||"function"==typeof t)&&I(t.TransferSui)||(null!==t&&"object"==typeof t||"function"==typeof t)&&D(t.ChangeEpoch)}function M(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.transactions)&&t.transactions.every((function(t){return L(t)}))&&x(t.sender)&&m(t.gasPayment)&&B(t.gasBudget)}function N(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.epoch)&&Array.isArray(t.signatures)&&t.signatures.every((function(t){return x(t)}))}function K(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.transactionDigest)&&M(t.data)&&x(t.txSignature)&&N(t.authSignInfo)}function W(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.computationCost)&&B(t.storageCost)&&B(t.storageRebate)}function G(t,e){return"success"===t||"failure"===t}function z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&G(t.status)&&(void 0===t.error||x(t.error))}function F(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&w(t.owner)&&m(t.reference)}function U(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&z(t.status)&&W(t.gasUsed)&&(void 0===t.sharedObjects||Array.isArray(t.sharedObjects)&&t.sharedObjects.every((function(t){return m(t)})))&&x(t.transactionDigest)&&(void 0===t.created||Array.isArray(t.created)&&t.created.every((function(t){return F(t)})))&&(void 0===t.mutated||Array.isArray(t.mutated)&&t.mutated.every((function(t){return F(t)})))&&(void 0===t.unwrapped||Array.isArray(t.unwrapped)&&t.unwrapped.every((function(t){return F(t)})))&&(void 0===t.deleted||Array.isArray(t.deleted)&&t.deleted.every((function(t){return m(t)})))&&(void 0===t.wrapped||Array.isArray(t.wrapped)&&t.wrapped.every((function(t){return m(t)})))&&F(t.gasObject)&&(void 0===t.events||Array.isArray(t.events))&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every((function(t){return x(t)})))}function V(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&U(t.effects)&&(null===t.timestamp_ms||B(t.timestamp_ms))}function Z(t,e){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&B(t[0])&&x(t[1])}))}function J(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.package)&&x(t.module)&&x(t.function)&&(void 0===t.typeArguments||Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return x(t)})))&&(void 0===t.arguments||Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)})))}function Y(t,e){return x(t)||B(t)||!1===t||!0===t||Array.isArray(t)&&t.every((function(t){return x(t)||B(t)||!1===t||!0===t}))}function Q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.txBytes)&&m(t.gas)}function X(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&k(t.updatedCoin)&&k(t.updatedGas)}function $(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&k(t.updatedCoin)&&Array.isArray(t.newCoins)&&t.newCoins.every((function(t){return k(t)}))&&k(t.updatedGas)}function H(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&Array.isArray(t.createdObjects)&&t.createdObjects.every((function(t){return k(t)}))&&tt(t.package)&&k(t.updatedGas)}function tt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.digest)&&x(t.objectId)&&B(t.version)}function et(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&V(t.EffectResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&$(t.SplitCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&X(t.MergeCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&H(t.PublishResponse)}function rt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"2.0"===t.jsonrpc&&x(t.id)}var nt=require("lossless-json"),ot=function(){function t(t,e){this.rpcClient=this.createRpcClient(t,e)}var e=t.prototype;return e.createRpcClient=function(t,e){return new u(function(){var r=y(v.mark((function r(n,o){var i,s,u,c;return v.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i={method:"POST",body:n,headers:Object.assign({"Content-Type":"application/json"},e||{})},r.prev=1,r.next=4,a(t,i);case 4:return s=r.sent,r.next=7,s.text();case 7:u=r.sent,c=JSON.stringify(nt.parse(u,(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}))),s.ok?o(null,c):o(new Error(s.status+" "+s.statusText+": "+u)),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),r.t0 instanceof Error&&o(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=y(v.mark((function t(e,r,n){var o;return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.request(e,r);case 2:if((null===(i=o=t.sent)||"object"!=typeof i)&&"function"!=typeof i||"2.0"!==i.jsonrpc||!x(i.id)||(null===i.error||"object"!=typeof i.error)&&"function"!=typeof i.error||!x(i.error.message)){t.next=7;break}throw new Error("RPC Error: "+o.error.message);case 7:if(!rt(o)){t.next=13;break}if(!n(o.result)){t.next=12;break}return t.abrupt("return",o.result);case 12:throw new Error("RPC Error: result not of expected type. Result received was: "+JSON.stringify(o.result));case 13:throw new Error("Unexpected RPC Response: "+o);case 14:case"end":return t.stop()}var i}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.request=function(){var t=y(v.mark((function t(e,r){var n=this;return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){n.rpcClient.request(e,r,(function(e,r){e?o(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=y(v.mark((function t(e,r){var n;return v.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=y(v.mark((function t(e){var r=this;return v.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 o=e.map((function(t){return r.rpcClient.request(t.method,t.args)}));r.rpcClient.request(o,(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},st=function(t){function e(e){var r;return(r=t.call(this)||this).endpoint=e,r.client=new ot(e),r}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObject",[e],R);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=y(v.mark((function t(e){var r;return v.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,R);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=y(v.mark((function t(e){var r,n;return v.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,Z);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=y(v.mark((function t(e){var r,n;return v.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,Z);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=y(v.mark((function t(e){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransaction",[e],V);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=y(v.mark((function t(e){var r,n;return v.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,V);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=y(v.mark((function t(e,r,n){return v.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=y(v.mark((function t(){return v.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=y(v.mark((function t(e,r){return v.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],Z);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=y(v.mark((function t(e){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getRecentTransactions",[e],Z);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}(l),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}(),at=function(){function t(t){this.client=new ot(t)}var e=t.prototype;return e.newTransferObject=function(){var t=y(v.mark((function t(e,r){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_transferObject",[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=y(v.mark((function t(e,r){return v.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=y(v.mark((function t(e,r){return v.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=y(v.mark((function t(e,r){return v.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)}}(),e.newPublish=function(){var t=y(v.mark((function t(e,r){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_publish",[e,r.compiledModules,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 publishing package "+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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e,r,n){return v.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=y(v.mark((function t(){return v.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=y(v.mark((function t(e,r){return v.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=y(v.mark((function t(e){return v.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}(l),ft=function(){function t(t,e){this.provider=t||new ct;var r="";this.provider instanceof st&&(r=this.provider.endpoint),this.serializer=e||new at(r)}var e=t.prototype;return e.signAndExecuteTransaction=function(){var t=y(v.mark((function t(e){var r;return v.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.transferObject=function(){var t=y(v.mark((function t(e){var r,n;return v.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.newTransferObject(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=y(v.mark((function t(e){var r,n;return v.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=y(v.mark((function t(e){var r,n;return v.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=y(v.mark((function t(e){var r,n;return v.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)}}(),e.publish=function(){var t=y(v.mark((function t(e){var r,n;return v.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.newPublish(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 o;return(o=t.call(this,r,n)||this).keypair=e,o}d(e,t);var r=e.prototype;return r.getAddress=function(){var t=y(v.mark((function t(){return v.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=y(v.mark((function t(e){return v.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),lt=/^(?:[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 dt(t){return"Deleted"!==t.status?void 0:t.details}function gt(t){return"NotExists"!==t.status?void 0:t.details}function vt(t){var e;return(null==(e=yt(t))?void 0:e.reference)||dt(t)}function bt(t){var e;return null==(e=wt(t))?void 0:e.type}function xt(t){var e;return null==(e=wt(t))?void 0:e.fields}function wt(t){var e="data"in t?t:yt(t);if("moveObject"===(null==e?void 0:e.data.dataType))return e.data}function mt(t){return t.effects.status}function jt(t){return t.effects.gasUsed}function Tt(t){return"SplitCoinResponse"in t?t.SplitCoinResponse:void 0}function Et(t){return"MergeCoinResponse"in t?t.MergeCoinResponse:void 0}var Ot=function(){function t(){}return t.isCoin=function(t){var e,r;return null!=(e=null==(r=bt(t))?void 0:r.startsWith("0x2::coin::Coin"))&&e},t.getBalance=function(e){var r;if(t.isCoin(e)){var n=null==(r=xt(e))?void 0:r.balance;return new o.BN(n,10)}},t.getZero=function(){return new o.BN("0",10)},t}();exports.Base64DataBuffer=c,exports.Coin=Ot,exports.Ed25519Keypair=p,exports.HexDataBuffer=ut,exports.JsonRpcProvider=st,exports.PUBLIC_KEY_SIZE=32,exports.Provider=l,exports.PublicKey=f,exports.RawSigner=pt,exports.RpcTxnDataSerializer=at,exports.SignerWithProvider=ft,exports.getChangeEpochTransaction=function(t){return"ChangeEpoch"in t?t.ChangeEpoch:void 0},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=wt,exports.getMoveObjectType=bt,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=dt,exports.getObjectExistsResponse=yt,exports.getObjectFields=xt,exports.getObjectId=function(t){var e,r;return"objectId"in t?t.objectId:null!=(e=null==(r=vt(t))?void 0:r.objectId)?e:gt(t)},exports.getObjectNotExistsResponse=gt,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=vt,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=vt(t))?void 0:e.version},exports.getPublishResponse=function(t){return"PublishResponse"in t?t.PublishResponse:void 0},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.getTransferObjectTransaction=function(t){return"TransferObject"in t?t.TransferObject:void 0},exports.getTransferSuiTransaction=function(t){return"TransferSui"in t?t.TransferSui:void 0},exports.hasPublicTransfer=function(t){var e,r;return null!=(e=null==(r=wt(t))?void 0:r.has_public_transfer)&&e},exports.isAuthorityName=function(t,e){return"string"==typeof t},exports.isAuthorityQuorumSignInfo=N,exports.isAuthoritySignature=function(t,e){return"string"==typeof t},exports.isCertifiedTransaction=K,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=z,exports.isExecutionStatusType=G,exports.isGasCostSummary=W,exports.isGatewayTxSeqNumber=function(t,e){return"number"==typeof t},exports.isGetObjectDataResponse=R,exports.isGetOwnedObjectsResponse=_,exports.isGetTxnDigestsResponse=Z,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)&&x(t.primaryCoin)&&x(t.coinToMerge)&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isMoveCall=J,exports.isMoveCallTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.packageObjectId)&&x(t.module)&&x(t.function)&&Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return x(t)}))&&Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)}))&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isMovePackageContent=E,exports.isObjectContentFields=T,exports.isObjectDigest=function(t,e){return"string"==typeof t},exports.isObjectId=function(t,e){return"string"==typeof t},exports.isObjectOwner=w,exports.isObjectStatus=C,exports.isObjectType=P,exports.isOwnedObjectRef=F,exports.isPublicKeyData=b,exports.isPublicKeyInitData=function(t,e){return x(t)||B(t)||t instanceof Buffer||t instanceof Uint8Array||Array.isArray(t)&&t.every((function(t){return B(t)}))||b(t)},exports.isPublishResponse=H,exports.isPublishTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.compiledModules)&&t.compiledModules.every((function(t){return x(t)}))&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isSequenceNumber=B,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=$,exports.isSplitCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.coinObjectId)&&Array.isArray(t.splitAmounts)&&t.splitAmounts.every((function(t){return B(t)}))&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isSuiAddress=function(t,e){return"string"==typeof t},exports.isSuiChangeEpoch=D,exports.isSuiData=O,exports.isSuiJsonValue=Y,exports.isSuiMoveObject=A,exports.isSuiMovePackage=S,exports.isSuiObject=k,exports.isSuiObjectInfo=j,exports.isSuiObjectRef=m,exports.isSuiPackage=tt,exports.isSuiTransactionKind=L,exports.isSuiTransferSui=I,exports.isTransactionBytes=Q,exports.isTransactionData=M,exports.isTransactionDigest=x,exports.isTransactionEffects=U,exports.isTransactionEffectsResponse=V,exports.isTransactionKindName=function(t,e){return"TransferObject"===t||"Publish"===t||"Call"===t||"TransferSui"===t||"ChangeEpoch"===t},exports.isTransactionResponse=et,exports.isTransferObject=q,exports.isTransferObjectTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.objectId)&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)&&x(t.recipient)},exports.isTxnDataSerializer=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.newTransferObject&&"function"==typeof t.newMoveCall&&"function"==typeof t.newMergeCoin&&"function"==typeof t.newSplitCoin&&"function"==typeof t.newPublish},exports.isValidSuiAddress=ht,exports.isValidSuiObjectId=function(t){return ht(t)},exports.isValidTransactionDigest=function(t){return 32===new c(t).getLength()&<.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"),o=t(n),i=require("js-sha3"),s=require("util"),u=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 o(e)}else this._bn=new o(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=i.sha3_256(this.toBytes());return new o(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 o=e.sign.keyPair.fromSecretKey(r);if(!n||!n.skipValidation){var i=(new s.TextEncoder).encode("sui validation"),u=e.sign.detached(i,o.secretKey);if(!e.sign.detached.verify(i,u,o.publicKey))throw new Error("provided secretKey is invalid")}return new t(o)},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}(),l=function(){};function h(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function y(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){h(i,n,o,s,u,"next",t)}function u(t){h(i,n,o,s,u,"throw",t)}s(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)}var g,v=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new T(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var u=w(s,r);if(u){if(u===f)continue;return u}}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,i),o}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 l(){}function h(){}var y={};u(y,o,(function(){return this}));var d=Object.getPrototypeOf,g=d&&d(d(E([])));g&&g!==e&&r.call(g,o)&&(y=g);var v=h.prototype=p.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;this._invoke=function(o,i){function s(){return new e((function(n,s){!function n(o,i,s,u){var a=c(t[o],t,i);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,s,u)}),(function(t){n("throw",t,s,u)})):e.resolve(p).then((function(t){f.value=t,s(f)}),(function(t){return n("throw",t,s,u)}))}u(a.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function w(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,w(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 o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(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[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=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 i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return l.prototype=h,u(v,"constructor",h),u(h,"constructor",l),l.displayName=u(h,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,s,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new x(a(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},b(v),u(v,s,"Generator"),u(v,o,(function(){return this})),u(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,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 s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),a=r.call(i,"finallyLoc");if(u&&a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(s)},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 o=n.arg;j(r)}return o}}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)}}(g={exports:{}}),g.exports);function b(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t._bn instanceof n.BN}function x(t,e){return"string"==typeof t}function w(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.AddressOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.ObjectOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.SingleOwner)||"Shared"===t||"Immutable"===t}function m(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.digest)&&x(t.objectId)&&B(t.version)}function j(t,e){return m(t)&&(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.type)&&w(t.owner)&&x(t.previousTransaction)}function T(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){return x(t[0])}))}function E(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){var e=t[0];return x(t[1])&&x(e)}))}function O(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&A(t)||(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&S(t)}function A(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.type)&&T(t.fields)&&(void 0===t.has_public_transfer||!1===t.has_public_transfer||!0===t.has_public_transfer)}function S(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&E(t.disassembled)}function k(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&O(t.data)&&w(t.owner)&&x(t.previousTransaction)&&B(t.storageRebate)&&m(t.reference)}function C(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 j(t)}))}function R(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&C(t.status)&&(x(t.details)||m(t.details)||k(t.details))}function B(t,e){return"number"==typeof t}function q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.recipient)&&m(t.objectRef)}function I(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.recipient)&&(null===t.amount||B(t.amount))}function D(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.epoch)&&B(t.storage_charge)&&B(t.computation_charge)}function L(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&q(t.TransferObject)||(null!==t&&"object"==typeof t||"function"==typeof t)&&S(t.Publish)||(null!==t&&"object"==typeof t||"function"==typeof t)&&J(t.Call)||(null!==t&&"object"==typeof t||"function"==typeof t)&&I(t.TransferSui)||(null!==t&&"object"==typeof t||"function"==typeof t)&&D(t.ChangeEpoch)}function M(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.transactions)&&t.transactions.every((function(t){return L(t)}))&&x(t.sender)&&m(t.gasPayment)&&B(t.gasBudget)}function N(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.epoch)&&Array.isArray(t.signature)&&t.signature.every((function(t){return x(t)}))}function K(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.transactionDigest)&&M(t.data)&&x(t.txSignature)&&N(t.authSignInfo)}function W(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.computationCost)&&B(t.storageCost)&&B(t.storageRebate)}function G(t,e){return"success"===t||"failure"===t}function z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&G(t.status)&&(void 0===t.error||x(t.error))}function F(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&w(t.owner)&&m(t.reference)}function U(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&z(t.status)&&W(t.gasUsed)&&(void 0===t.sharedObjects||Array.isArray(t.sharedObjects)&&t.sharedObjects.every((function(t){return m(t)})))&&x(t.transactionDigest)&&(void 0===t.created||Array.isArray(t.created)&&t.created.every((function(t){return F(t)})))&&(void 0===t.mutated||Array.isArray(t.mutated)&&t.mutated.every((function(t){return F(t)})))&&(void 0===t.unwrapped||Array.isArray(t.unwrapped)&&t.unwrapped.every((function(t){return F(t)})))&&(void 0===t.deleted||Array.isArray(t.deleted)&&t.deleted.every((function(t){return m(t)})))&&(void 0===t.wrapped||Array.isArray(t.wrapped)&&t.wrapped.every((function(t){return m(t)})))&&F(t.gasObject)&&(void 0===t.events||Array.isArray(t.events))&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every((function(t){return x(t)})))}function V(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&U(t.effects)&&(null===t.timestamp_ms||B(t.timestamp_ms))}function Z(t,e){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&B(t[0])&&x(t[1])}))}function J(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.package)&&x(t.module)&&x(t.function)&&(void 0===t.typeArguments||Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return x(t)})))&&(void 0===t.arguments||Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)})))}function Y(t,e){return x(t)||B(t)||!1===t||!0===t||Array.isArray(t)&&t.every((function(t){return x(t)||B(t)||!1===t||!0===t}))}function Q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.txBytes)&&m(t.gas)}function X(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&k(t.updatedCoin)&&k(t.updatedGas)}function $(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&k(t.updatedCoin)&&Array.isArray(t.newCoins)&&t.newCoins.every((function(t){return k(t)}))&&k(t.updatedGas)}function H(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.certificate)&&Array.isArray(t.createdObjects)&&t.createdObjects.every((function(t){return k(t)}))&&tt(t.package)&&k(t.updatedGas)}function tt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.digest)&&x(t.objectId)&&B(t.version)}function et(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&V(t.EffectResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&$(t.SplitCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&X(t.MergeCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&H(t.PublishResponse)}function rt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"2.0"===t.jsonrpc&&x(t.id)}var nt=require("lossless-json"),ot=function(){function t(t,e){this.rpcClient=this.createRpcClient(t,e)}var e=t.prototype;return e.createRpcClient=function(t,e){return new u(function(){var r=y(v.mark((function r(n,o){var i,s,u,c;return v.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i={method:"POST",body:n,headers:Object.assign({"Content-Type":"application/json"},e||{})},r.prev=1,r.next=4,a(t,i);case 4:return s=r.sent,r.next=7,s.text();case 7:u=r.sent,c=JSON.stringify(nt.parse(u,(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}))),s.ok?o(null,c):o(new Error(s.status+" "+s.statusText+": "+u)),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),r.t0 instanceof Error&&o(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=y(v.mark((function t(e,r,n){var o;return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.request(e,r);case 2:if((null===(i=o=t.sent)||"object"!=typeof i)&&"function"!=typeof i||"2.0"!==i.jsonrpc||!x(i.id)||(null===i.error||"object"!=typeof i.error)&&"function"!=typeof i.error||!x(i.error.message)){t.next=7;break}throw new Error("RPC Error: "+o.error.message);case 7:if(!rt(o)){t.next=13;break}if(!n(o.result)){t.next=12;break}return t.abrupt("return",o.result);case 12:throw new Error("RPC Error: result not of expected type. Result received was: "+JSON.stringify(o.result));case 13:throw new Error("Unexpected RPC Response: "+o);case 14:case"end":return t.stop()}var i}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.request=function(){var t=y(v.mark((function t(e,r){var n=this;return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){n.rpcClient.request(e,r,(function(e,r){e?o(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=y(v.mark((function t(e,r){var n;return v.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=y(v.mark((function t(e){var r=this;return v.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 o=e.map((function(t){return r.rpcClient.request(t.method,t.args)}));r.rpcClient.request(o,(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},st=function(t){function e(e){var r;return(r=t.call(this)||this).endpoint=e,r.client=new ot(e),r}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObject",[e],R);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=y(v.mark((function t(e){var r;return v.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,R);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=y(v.mark((function t(e){var r,n;return v.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,Z);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=y(v.mark((function t(e){var r,n;return v.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,Z);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=y(v.mark((function t(e){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransaction",[e],V);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=y(v.mark((function t(e){var r,n;return v.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,V);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=y(v.mark((function t(e,r,n){return v.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=y(v.mark((function t(){return v.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=y(v.mark((function t(e,r){return v.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],Z);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=y(v.mark((function t(e){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getRecentTransactions",[e],Z);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}(l),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}(),at=function(){function t(t){this.client=new ot(t)}var e=t.prototype;return e.newTransferObject=function(){var t=y(v.mark((function t(e,r){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_transferObject",[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 object: "+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.newTransferSui=function(){var t=y(v.mark((function t(e,r){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_transferSui",[e,r.suiObjectId,r.gasBudget,r.recipient,r.amount],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 Sui 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=y(v.mark((function t(e,r){return v.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=y(v.mark((function t(e,r){return v.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=y(v.mark((function t(e,r){return v.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)}}(),e.newPublish=function(){var t=y(v.mark((function t(e,r){return v.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_publish",[e,r.compiledModules,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 publishing package "+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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e){return v.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=y(v.mark((function t(e,r,n){return v.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=y(v.mark((function t(){return v.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=y(v.mark((function t(e,r){return v.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=y(v.mark((function t(e){return v.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}(l),ft=function(){function t(t,e){this.provider=t||new ct;var r="";this.provider instanceof st&&(r=this.provider.endpoint),this.serializer=e||new at(r)}var e=t.prototype;return e.signAndExecuteTransaction=function(){var t=y(v.mark((function t(e){var r;return v.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.transferObject=function(){var t=y(v.mark((function t(e){var r,n;return v.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.newTransferObject(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.transferSui=function(){var t=y(v.mark((function t(e){var r,n;return v.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.newTransferSui(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=y(v.mark((function t(e){var r,n;return v.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=y(v.mark((function t(e){var r,n;return v.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=y(v.mark((function t(e){var r,n;return v.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)}}(),e.publish=function(){var t=y(v.mark((function t(e){var r,n;return v.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.newPublish(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 o;return(o=t.call(this,r,n)||this).keypair=e,o}d(e,t);var r=e.prototype;return r.getAddress=function(){var t=y(v.mark((function t(){return v.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=y(v.mark((function t(e){return v.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),lt=/^(?:[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 dt(t){return"Deleted"!==t.status?void 0:t.details}function gt(t){return"NotExists"!==t.status?void 0:t.details}function vt(t){var e;return(null==(e=yt(t))?void 0:e.reference)||dt(t)}function bt(t){var e;return null==(e=wt(t))?void 0:e.type}function xt(t){var e;return null==(e=wt(t))?void 0:e.fields}function wt(t){var e="data"in t?t:yt(t);if("moveObject"===(null==e?void 0:e.data.dataType))return e.data}function mt(t){return t.effects.status}function jt(t){return t.effects.gasUsed}function Tt(t){return"SplitCoinResponse"in t?t.SplitCoinResponse:void 0}function Et(t){return"MergeCoinResponse"in t?t.MergeCoinResponse:void 0}var Ot=function(){function t(){}return t.isCoin=function(t){var e,r;return null!=(e=null==(r=bt(t))?void 0:r.startsWith("0x2::coin::Coin"))&&e},t.getBalance=function(e){var r;if(t.isCoin(e)){var n=null==(r=xt(e))?void 0:r.balance;return new o.BN(n,10)}},t.getZero=function(){return new o.BN("0",10)},t}();exports.Base64DataBuffer=c,exports.Coin=Ot,exports.Ed25519Keypair=p,exports.HexDataBuffer=ut,exports.JsonRpcProvider=st,exports.PUBLIC_KEY_SIZE=32,exports.Provider=l,exports.PublicKey=f,exports.RawSigner=pt,exports.RpcTxnDataSerializer=at,exports.SignerWithProvider=ft,exports.getChangeEpochTransaction=function(t){return"ChangeEpoch"in t?t.ChangeEpoch:void 0},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=wt,exports.getMoveObjectType=bt,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=dt,exports.getObjectExistsResponse=yt,exports.getObjectFields=xt,exports.getObjectId=function(t){var e,r;return"objectId"in t?t.objectId:null!=(e=null==(r=vt(t))?void 0:r.objectId)?e:gt(t)},exports.getObjectNotExistsResponse=gt,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=vt,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=vt(t))?void 0:e.version},exports.getPublishResponse=function(t){return"PublishResponse"in t?t.PublishResponse:void 0},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.getTransferObjectTransaction=function(t){return"TransferObject"in t?t.TransferObject:void 0},exports.getTransferSuiTransaction=function(t){return"TransferSui"in t?t.TransferSui:void 0},exports.hasPublicTransfer=function(t){var e,r;return null!=(e=null==(r=wt(t))?void 0:r.has_public_transfer)&&e},exports.isAuthorityName=function(t,e){return"string"==typeof t},exports.isAuthorityQuorumSignInfo=N,exports.isAuthoritySignature=function(t,e){return"string"==typeof t},exports.isCertifiedTransaction=K,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=z,exports.isExecutionStatusType=G,exports.isGasCostSummary=W,exports.isGatewayTxSeqNumber=function(t,e){return"number"==typeof t},exports.isGetObjectDataResponse=R,exports.isGetOwnedObjectsResponse=_,exports.isGetTxnDigestsResponse=Z,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)&&x(t.primaryCoin)&&x(t.coinToMerge)&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isMoveCall=J,exports.isMoveCallTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.packageObjectId)&&x(t.module)&&x(t.function)&&Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return x(t)}))&&Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)}))&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isMovePackageContent=E,exports.isObjectContentFields=T,exports.isObjectDigest=function(t,e){return"string"==typeof t},exports.isObjectId=function(t,e){return"string"==typeof t},exports.isObjectOwner=w,exports.isObjectStatus=C,exports.isObjectType=P,exports.isOwnedObjectRef=F,exports.isPublicKeyData=b,exports.isPublicKeyInitData=function(t,e){return x(t)||B(t)||t instanceof Buffer||t instanceof Uint8Array||Array.isArray(t)&&t.every((function(t){return B(t)}))||b(t)},exports.isPublishResponse=H,exports.isPublishTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.compiledModules)&&t.compiledModules.every((function(t){return x(t)}))&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isSequenceNumber=B,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=$,exports.isSplitCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.coinObjectId)&&Array.isArray(t.splitAmounts)&&t.splitAmounts.every((function(t){return B(t)}))&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)},exports.isSuiAddress=function(t,e){return"string"==typeof t},exports.isSuiChangeEpoch=D,exports.isSuiData=O,exports.isSuiJsonValue=Y,exports.isSuiMoveObject=A,exports.isSuiMovePackage=S,exports.isSuiObject=k,exports.isSuiObjectInfo=j,exports.isSuiObjectRef=m,exports.isSuiPackage=tt,exports.isSuiTransactionKind=L,exports.isSuiTransferSui=I,exports.isTransactionBytes=Q,exports.isTransactionData=M,exports.isTransactionDigest=x,exports.isTransactionEffects=U,exports.isTransactionEffectsResponse=V,exports.isTransactionKindName=function(t,e){return"TransferObject"===t||"Publish"===t||"Call"===t||"TransferSui"===t||"ChangeEpoch"===t},exports.isTransactionResponse=et,exports.isTransferObject=q,exports.isTransferObjectTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.objectId)&&(void 0===t.gasPayment||x(t.gasPayment))&&B(t.gasBudget)&&x(t.recipient)},exports.isTransferSuiTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.suiObjectId)&&B(t.gasBudget)&&x(t.recipient)&&(void 0===t.amount||B(t.amount))},exports.isTxnDataSerializer=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.newTransferObject&&"function"==typeof t.newTransferSui&&"function"==typeof t.newMoveCall&&"function"==typeof t.newMergeCoin&&"function"==typeof t.newSplitCoin&&"function"==typeof t.newPublish},exports.isValidSuiAddress=ht,exports.isValidSuiObjectId=function(t){return ht(t)},exports.isValidTransactionDigest=function(t){return 32===new c(t).getLength()&<.test(t)}; | ||
//# sourceMappingURL=sui.js.cjs.production.min.js.map |
@@ -26,3 +26,3 @@ import { ObjectOwner } from './common'; | ||
fields: ObjectContentFields; | ||
has_public_transfer: boolean; | ||
has_public_transfer?: boolean; | ||
}; | ||
@@ -29,0 +29,0 @@ export declare type SuiMovePackage = { |
@@ -37,3 +37,3 @@ import { ObjectOwner, SuiAddress, TransactionDigest } from './common'; | ||
epoch: EpochId; | ||
signatures: AuthoritySignature[]; | ||
signature: AuthoritySignature[]; | ||
}; | ||
@@ -40,0 +40,0 @@ export declare type CertifiedTransaction = { |
{ | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"license": "Apache-2.0", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -8,3 +8,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
*/ | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferObjectTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, PublishTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferObject, SuiTransferSui, SuiChangeEpoch, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, PublishResponse, SuiPackage, TransactionResponse } from "./index"; | ||
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferObjectTransaction, TransferSuiTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, PublishTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferObject, SuiTransferSui, SuiChangeEpoch, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, PublishResponse, SuiPackage, TransactionResponse } from "./index"; | ||
import { BN } from "bn.js"; | ||
@@ -70,2 +70,15 @@ import { Base64DataBuffer } from "./serialization/base64"; | ||
export function isTransferSuiTransaction(obj: any, _argumentName?: string): obj is TransferSuiTransaction { | ||
return ( | ||
(obj !== null && | ||
typeof obj === "object" || | ||
typeof obj === "function") && | ||
isTransactionDigest(obj.suiObjectId) as boolean && | ||
isSequenceNumber(obj.gasBudget) as boolean && | ||
isTransactionDigest(obj.recipient) as boolean && | ||
(typeof obj.amount === "undefined" || | ||
isSequenceNumber(obj.amount) as boolean) | ||
) | ||
} | ||
export function isMergeCoinTransaction(obj: any, _argumentName?: string): obj is MergeCoinTransaction { | ||
@@ -143,2 +156,3 @@ return ( | ||
typeof obj.newTransferObject === "function" && | ||
typeof obj.newTransferSui === "function" && | ||
typeof obj.newMoveCall === "function" && | ||
@@ -268,3 +282,5 @@ typeof obj.newMergeCoin === "function" && | ||
isObjectContentFields(obj.fields) as boolean && | ||
typeof obj.has_public_transfer === "boolean" | ||
(typeof obj.has_public_transfer === "undefined" || | ||
obj.has_public_transfer === false || | ||
obj.has_public_transfer === true) | ||
) | ||
@@ -443,4 +459,4 @@ } | ||
isSequenceNumber(obj.epoch) as boolean && | ||
Array.isArray(obj.signatures) && | ||
obj.signatures.every((e: any) => | ||
Array.isArray(obj.signature) && | ||
obj.signature.every((e: any) => | ||
isTransactionDigest(e) as boolean | ||
@@ -447,0 +463,0 @@ ) |
@@ -16,2 +16,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
TransferObjectTransaction, | ||
TransferSuiTransaction, | ||
TxnDataSerializer, | ||
@@ -85,2 +86,16 @@ PublishTransaction, | ||
/** | ||
* Serialize and Sign a `TransferSui` transaction and submit to the Gateway for execution | ||
*/ | ||
async transferSui( | ||
transaction: TransferSuiTransaction | ||
): Promise<TransactionResponse> { | ||
const signerAddress = await this.getAddress(); | ||
const txBytes = await this.serializer.newTransferSui( | ||
signerAddress, | ||
transaction | ||
); | ||
return await this.signAndExecuteTransaction(txBytes); | ||
} | ||
/** | ||
* Serialize and Sign a `MergeCoin` transaction and submit to the Gateway for execution | ||
@@ -87,0 +102,0 @@ */ |
@@ -13,2 +13,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
TransferObjectTransaction, | ||
TransferSuiTransaction, | ||
PublishTransaction, | ||
@@ -49,6 +50,22 @@ TxnDataSerializer, | ||
} catch (err) { | ||
throw new Error(`Error transferring coin: ${err} with args ${t}`); | ||
throw new Error(`Error transferring object: ${err} with args ${t}`); | ||
} | ||
} | ||
async newTransferSui( | ||
signerAddress: SuiAddress, | ||
t: TransferSuiTransaction | ||
): Promise<Base64DataBuffer> { | ||
try { | ||
const resp = await this.client.requestWithType( | ||
'sui_transferSui', | ||
[signerAddress, t.suiObjectId, t.gasBudget, t.recipient, t.amount], | ||
isTransactionBytes | ||
); | ||
return new Base64DataBuffer(resp.txBytes); | ||
} catch (err) { | ||
throw new Error(`Error transferring Sui coin: ${err} with args ${t}`); | ||
} | ||
} | ||
async newMoveCall( | ||
@@ -55,0 +72,0 @@ signerAddress: SuiAddress, |
@@ -16,2 +16,9 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
export interface TransferSuiTransaction { | ||
suiObjectId: ObjectId; | ||
gasBudget: number; | ||
recipient: SuiAddress; | ||
amount?: number; | ||
} | ||
export interface MergeCoinTransaction { | ||
@@ -59,2 +66,7 @@ primaryCoin: ObjectId; | ||
newTransferSui( | ||
signerAddress: SuiAddress, | ||
txn: TransferSuiTransaction | ||
): Promise<Base64DataBuffer>; | ||
newMoveCall( | ||
@@ -61,0 +73,0 @@ signerAddress: SuiAddress, |
@@ -36,3 +36,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
fields: ObjectContentFields; | ||
has_public_transfer: boolean; | ||
has_public_transfer?: boolean; | ||
}; | ||
@@ -39,0 +39,0 @@ |
@@ -47,3 +47,3 @@ // Copyright (c) 2022, Mysten Labs, Inc. | ||
epoch: EpochId; | ||
signatures: AuthoritySignature[]; | ||
signature: AuthoritySignature[]; | ||
}; | ||
@@ -50,0 +50,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
881862
8726