Socket
Socket
Sign inDemoInstall

@mysten/sui.js

Package Overview
Dependencies
Maintainers
2
Versions
895
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mysten/sui.js - npm Package Compare versions

Comparing version 0.4.0 to 0.6.0

1

dist/index.d.ts

@@ -15,2 +15,1 @@ export * from './cryptography/ed25519-keypair';

export * from './index.guard';
export * as BCS from './bcs';

7

dist/index.guard.d.ts

@@ -1,2 +0,2 @@

import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferCoinTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferCoin, RawAuthoritySignInfo, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index";
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferObjectTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferObject, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index";
export declare function isEd25519KeypairData(obj: any, _argumentName?: string): obj is Ed25519KeypairData;

@@ -6,3 +6,3 @@ export declare function isKeypair(obj: any, _argumentName?: string): obj is Keypair;

export declare function isPublicKeyData(obj: any, _argumentName?: string): obj is PublicKeyData;
export declare function isTransferCoinTransaction(obj: any, _argumentName?: string): obj is TransferCoinTransaction;
export declare function isTransferObjectTransaction(obj: any, _argumentName?: string): obj is TransferObjectTransaction;
export declare function isMergeCoinTransaction(obj: any, _argumentName?: string): obj is MergeCoinTransaction;

@@ -32,4 +32,3 @@ export declare function isSplitCoinTransaction(obj: any, _argumentName?: string): obj is SplitCoinTransaction;

export declare function isSequenceNumber(obj: any, _argumentName?: string): obj is SequenceNumber;
export declare function isTransferCoin(obj: any, _argumentName?: string): obj is TransferCoin;
export declare function isRawAuthoritySignInfo(obj: any, _argumentName?: string): obj is RawAuthoritySignInfo;
export declare function isTransferObject(obj: any, _argumentName?: string): obj is TransferObject;
export declare function isTransactionKindName(obj: any, _argumentName?: string): obj is TransactionKindName;

@@ -36,0 +35,0 @@ export declare function isSuiTransactionKind(obj: any, _argumentName?: string): obj is SuiTransactionKind;

@@ -5,3 +5,3 @@ import { Provider } from '../providers/provider';

import { SignaturePubkeyPair, Signer } from './signer';
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferCoinTransaction, TxnDataSerializer } from './txn-data-serializers/txn-data-serializer';
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferObjectTransaction, TxnDataSerializer } from './txn-data-serializers/txn-data-serializer';
export declare abstract class SignerWithProvider implements Signer {

@@ -24,5 +24,5 @@ readonly provider: Provider;

/**
* Serialize and Sign a `TransferCoin` transaction and submit to the Gateway for execution
* Serialize and Sign a `TransferObject` transaction and submit to the Gateway for execution
*/
transferCoin(transaction: TransferCoinTransaction): Promise<TransactionResponse>;
transferObject(transaction: TransferObjectTransaction): Promise<TransactionResponse>;
/**

@@ -29,0 +29,0 @@ * Serialize and Sign a `MergeCoin` transaction and submit to the Gateway for execution

import { Base64DataBuffer } from '../../serialization/base64';
import { SuiAddress } from '../../types';
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferCoinTransaction, TxnDataSerializer } from './txn-data-serializer';
import { MoveCallTransaction, MergeCoinTransaction, SplitCoinTransaction, TransferObjectTransaction, TxnDataSerializer } from './txn-data-serializer';
/**

@@ -19,3 +19,3 @@ * This is a temporary implementation of the `TxnDataSerializer` class

constructor(endpoint: string);
newTransferCoin(signerAddress: SuiAddress, t: TransferCoinTransaction): Promise<Base64DataBuffer>;
newTransferObject(signerAddress: SuiAddress, t: TransferObjectTransaction): Promise<Base64DataBuffer>;
newMoveCall(signerAddress: SuiAddress, t: MoveCallTransaction): Promise<Base64DataBuffer>;

@@ -22,0 +22,0 @@ newMergeCoin(signerAddress: SuiAddress, t: MergeCoinTransaction): Promise<Base64DataBuffer>;

import { Base64DataBuffer } from '../../serialization/base64';
import { ObjectId, SuiAddress, SuiJsonValue } from '../../types';
export interface TransferCoinTransaction {
export interface TransferObjectTransaction {
objectId: ObjectId;

@@ -34,3 +34,3 @@ gasPayment?: ObjectId;

export interface TxnDataSerializer {
newTransferCoin(signerAddress: SuiAddress, txn: TransferCoinTransaction): Promise<Base64DataBuffer>;
newTransferObject(signerAddress: SuiAddress, txn: TransferObjectTransaction): Promise<Base64DataBuffer>;
newMoveCall(signerAddress: SuiAddress, txn: MoveCallTransaction): Promise<Base64DataBuffer>;

@@ -37,0 +37,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"),i=t(n),o=require("js-sha3"),u=require("util"),s=t(require("jayson/lib/client/browser")),a=t(require("cross-fetch")),c=function(){function t(t){this.data="string"==typeof t?new Uint8Array(r.Buffer.from(t,"base64")):t}var e=t.prototype;return e.getData=function(){return this.data},e.getLength=function(){return this.data.length},e.toString=function(){return r.Buffer.from(this.data).toString("base64")},t}(),f=function(){function t(t){if(function(t){return void 0!==t._bn}(t))this._bn=t._bn;else{if("string"==typeof t){var e=r.Buffer.from(t,"base64");if(32!==e.length)throw new Error("Invalid public key input. Expected 32 bytes, got "+e.length);this._bn=new i(e)}else this._bn=new i(t);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}var e=t.prototype;return e.equals=function(t){return this._bn.eq(t._bn)},e.toBase64=function(){return this.toBuffer().toString("base64")},e.toBytes=function(){return this.toBuffer()},e.toBuffer=function(){var t=this._bn.toArrayLike(r.Buffer);if(32===t.length)return t;var e=r.Buffer.alloc(32);return t.copy(e,32-t.length),e},e.toString=function(){return this.toBase64()},e.toSuiAddress=function(){var t=o.sha3_256(this.toBytes());return new i(t,16).toArray(void 0,32).slice(0,20).reduce((function(t,e){return t+("0"+e.toString(16)).slice(-2)}),"")},t}(),p=function(){function t(t){this.keypair=t||e.sign.keyPair()}t.generate=function(){return new t(e.sign.keyPair())},t.fromSecretKey=function(r,n){var i=e.sign.keyPair.fromSecretKey(r);if(!n||!n.skipValidation){var o=(new u.TextEncoder).encode("sui validation"),s=e.sign.detached(o,i.secretKey);if(!e.sign.detached.verify(o,s,i.publicKey))throw new Error("provided secretKey is invalid")}return new t(i)},t.fromSeed=function(r){return new t(e.sign.keyPair.fromSeed(r))};var r=t.prototype;return r.getPublicKey=function(){return new f(this.keypair.publicKey)},r.signData=function(t){return new c(e.sign.detached(t.getData(),this.keypair.secretKey))},t}(),h=function(){};function y(t,e,r,n,i,o,u){try{var s=t[o](u),a=s.value}catch(t){return void r(t)}s.done?e(a):Promise.resolve(a).then(n,i)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function u(t){y(o,n,i,u,s,"next",t)}function s(t){y(o,n,i,u,s,"throw",t)}u(void 0)}))}}function d(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function v(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var w,b=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",u=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),o=new j(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var s=x(u,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var a=c(t,e,r);if("normal"===a.type){if(n=r.done?"completed":"suspendedYield",a.arg===f)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n="completed",r.method="throw",r.arg=a.arg)}}}(t,r,o),i}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var f={};function p(){}function h(){}function y(){}var l={};s(l,i,(function(){return this}));var d=Object.getPrototypeOf,g=d&&d(d(E([])));g&&g!==e&&r.call(g,i)&&(l=g);var v=y.prototype=p.prototype=Object.create(l);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(i,o){function u(){return new e((function(n,u){!function n(i,o,u,s){var a=c(t[i],t,o);if("throw"!==a.type){var f=a.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(p).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,s)}))}s(a.arg)}(i,o,n,u)}))}return n=n?n.then(u,u):u()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function E(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=y,s(v,"constructor",y),s(y,"constructor",h),h.displayName=s(y,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},w(b.prototype),s(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var u=new b(a(e,r,n,i),o);return t.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},w(v),s(v,u,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),a=r.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(w={exports:{}}),w.exports);function x(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t._bn instanceof n.BN}function m(t,e){return"string"==typeof t}function T(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.AddressOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.ObjectOwner)||(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.SingleOwner)||"Shared"===t||"Immutable"===t}function j(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.digest)&&m(t.objectId)&&L(t.version)}function E(t,e){return j(t)&&(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type)&&T(t.owner)&&m(t.previousTransaction)}function A(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){return m(t[0])}))}function O(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Object.entries(t).every((function(t){var e=t[0];return m(t[1])&&m(e)}))}function S(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&C(t)||(null!==t&&"object"==typeof t||"function"==typeof t)&&P(t.dataType)&&k(t)}function C(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.type)&&A(t.fields)}function k(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&O(t.disassembled)}function B(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&S(t.data)&&T(t.owner)&&m(t.previousTransaction)&&L(t.storageRebate)&&j(t.reference)}function R(t,e){return"Exists"===t||"NotExists"===t||"Deleted"===t}function P(t,e){return"moveObject"===t||"package"===t}function _(t,e){return Array.isArray(t)&&t.every((function(t){return E(t)}))}function I(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&R(t.status)&&(m(t.details)||j(t.details)||B(t.details))}function L(t,e){return"number"==typeof t}function N(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.recipient)&&j(t.objectRef)}function D(t,e){return Array.isArray(t)&&m(t[0])&&m(t[1])}function q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&N(t.TransferCoin)||(null!==t&&"object"==typeof t||"function"==typeof t)&&k(t.Publish)||(null!==t&&"object"==typeof t||"function"==typeof t)&&$(t.Call)}function U(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.transactions)&&t.transactions.every((function(t){return q(t)}))&&m(t.sender)&&j(t.gasPayment)&&L(t.gasBudget)}function V(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&L(t.epoch)&&Array.isArray(t.signatures)&&t.signatures.every((function(t){return D(t)}))}function M(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.transactionDigest)&&U(t.data)&&m(t.txSignature)&&V(t.authSignInfo)}function K(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&L(t.computationCost)&&L(t.storageCost)&&L(t.storageRebate)}function W(t,e){return"success"===t||"failure"===t}function G(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&W(t.status)&&(void 0===t.error||m(t.error))}function z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&T(t.owner)&&j(t.reference)}function F(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&G(t.status)&&K(t.gasUsed)&&(void 0===t.sharedObjects||Array.isArray(t.sharedObjects)&&t.sharedObjects.every((function(t){return j(t)})))&&m(t.transactionDigest)&&(void 0===t.created||Array.isArray(t.created)&&t.created.every((function(t){return z(t)})))&&(void 0===t.mutated||Array.isArray(t.mutated)&&t.mutated.every((function(t){return z(t)})))&&(void 0===t.unwrapped||Array.isArray(t.unwrapped)&&t.unwrapped.every((function(t){return z(t)})))&&(void 0===t.deleted||Array.isArray(t.deleted)&&t.deleted.every((function(t){return j(t)})))&&(void 0===t.wrapped||Array.isArray(t.wrapped)&&t.wrapped.every((function(t){return j(t)})))&&z(t.gasObject)&&(void 0===t.events||Array.isArray(t.events))&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every((function(t){return m(t)})))}function Z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&F(t.effects)}function J(t,e){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&L(t[0])&&m(t[1])}))}function $(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&j(t.package)&&m(t.module)&&m(t.function)&&(void 0===t.typeArguments||Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return m(t)})))&&(void 0===t.arguments||Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)})))}function Y(t,e){return m(t)||L(t)||!1===t||!0===t||Array.isArray(t)&&t.every((function(t){return m(t)||L(t)||!1===t||!0===t}))}function Q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.txBytes)&&j(t.gas)}function X(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&B(t.updatedCoin)&&B(t.updatedGas)}function H(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&B(t.updatedCoin)&&Array.isArray(t.newCoins)&&t.newCoins.every((function(t){return B(t)}))&&B(t.updatedGas)}function tt(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Z(t.EffectResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&H(t.SplitCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&X(t.MergeCoinResponse)}function et(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"2.0"===t.jsonrpc&&m(t.id)}var rt=require("lossless-json"),nt=function(){function t(t,e){this.rpcClient=this.createRpcClient(t,e)}var e=t.prototype;return e.createRpcClient=function(t,e){return new s(function(){var r=l(b.mark((function r(n,i){var o,u,s,c;return b.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o={method:"POST",body:n,headers:Object.assign({"Content-Type":"application/json"},e||{})},r.prev=1,r.next=4,a(t,o);case 4:return u=r.sent,r.next=7,u.text();case 7:s=r.sent,c=JSON.stringify(rt.parse(s,(function(t,e){if(null==e)return e;if("balance"===t)return e.toString();try{if(e.isLosslessNumber)return e.valueOf()}catch(t){return e.toString()}return e}))),u.ok?i(null,c):i(new Error(u.status+" "+u.statusText+": "+s)),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),r.t0 instanceof Error&&i(r.t0);case 15:case"end":return r.stop()}}),r,null,[[1,12]])})));return function(t,e){return r.apply(this,arguments)}}(),{})},e.requestWithType=function(){var t=l(b.mark((function t(e,r,n){var i;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.request(e,r);case 2:if((null===(o=i=t.sent)||"object"!=typeof o)&&"function"!=typeof o||"2.0"!==o.jsonrpc||!m(o.id)||(null===o.error||"object"!=typeof o.error)&&"function"!=typeof o.error||!m(o.error.message)){t.next=7;break}throw new Error("RPC Error: "+i.error.message);case 7:if(!et(i)){t.next=13;break}if(!n(i.result)){t.next=12;break}return t.abrupt("return",i.result);case 12:throw new Error("RPC Error: result not of expected type. Result received was: "+JSON.stringify(i.result));case 13:throw new Error("Unexpected RPC Response: "+i);case 14:case"end":return t.stop()}var o}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),e.request=function(){var t=l(b.mark((function t(e,r){var n=this;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,i){n.rpcClient.request(e,r,(function(e,r){e?i(e):t(r)}))})));case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e.batchRequestWithType=function(){var t=l(b.mark((function t(e,r){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.batchRequest(e);case 2:return n=t.sent.filter((function(t){return et(t)&&r(t.result)})),t.abrupt("return",n.map((function(t){return t.result})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),e.batchRequest=function(){var t=l(b.mark((function t(e){var r=this;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){0===e.length&&t([]);var i=e.map((function(t){return r.rpcClient.request(t.method,t.args)}));r.rpcClient.request(i,(function(e,r){e?n(e):t(r)}))})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t}(),it=function(t){return"number"==typeof t},ot=function(t){function e(e){var r;return(r=t.call(this)||this).endpoint=e,r.client=new nt(e),r}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObjectsOwnedByAddress",[e],_);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching owned object: "+t.t0+" for address "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObjectsOwnedByObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObjectsOwnedByObject",[e],_);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching owned object: "+t.t0+" for objectId "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getObject",[e],I);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching object info: "+t.t0+" for id "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),r.getObjectBatch=function(){var t=l(b.mark((function t(e){var r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{method:"sui_getObject",args:[t]}})),t.prev=1,t.next=4,this.client.batchRequestWithType(r,I);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),new Error("Error fetching object info: "+t.t0+" for id "+e);case 10:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionsForObject=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[{method:"sui_getTransactionsByInputObject",args:[e]},{method:"sui_getTransactionsByMutatedObject",args:[e]}],t.prev=1,t.next=4,this.client.batchRequestWithType(r,J);case 4:return t.abrupt("return",[].concat((n=t.sent)[0],n[1]));case 8:throw t.prev=8,t.t0=t.catch(1),new Error("Error getting transactions for object: "+t.t0+" for id "+e);case 11:case"end":return t.stop()}}),t,this,[[1,8]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionsForAddress=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[{method:"sui_getTransactionsToAddress",args:[e]},{method:"sui_getTransactionsFromAddress",args:[e]}],t.prev=1,t.next=4,this.client.batchRequestWithType(r,J);case 4:return t.abrupt("return",[].concat((n=t.sent)[0],n[1]));case 8:throw t.prev=8,t.t0=t.catch(1),new Error("Error getting transactions for address: "+t.t0+" for id "+e);case 11:case"end":return t.stop()}}),t,this,[[1,8]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffects=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransaction",[e],Z);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error getting transaction with effects: "+t.t0+" for digest "+e);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffectsBatch=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{method:"sui_getTransaction",args:[t]}})),t.prev=1,t.next=4,this.client.batchRequestWithType(r,Z);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),n=e.join(", ").substring(0,-2),new Error("Error getting transaction effects: "+t.t0+" for digests ["+n+"]");case 11:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=l(b.mark((function t(e,r,n){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_executeTransaction",[e,r,n],tt);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error executing transaction: "+t.t0+"}");case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getTotalTransactionNumber=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTotalTransactionNumber",[],it);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error fetching total transaction number: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(){return t.apply(this,arguments)}}(),r.getTransactionDigestsInRange=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getTransactionsInRange",[e,r],J);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching transaction digests in range: "+t.t0+" for range "+e+"-"+r);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}(),r.getRecentTransactions=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_getRecentTransactions",[e],J);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),new Error("Error fetching recent transactions: "+t.t0+" for count "+e);case 9:case"end":return t.stop()}}),t,this,[[0,6]])})));return function(e){return t.apply(this,arguments)}}(),e}(h),ut=function(){function t(t){this._data="string"==typeof t?new Uint8Array(r.Buffer.from(t,"hex")):t}var e=t.prototype;return e.getData=function(){return this._data},e.getLength=function(){return this._data.length},e.toString=function(){return r.Buffer.from(this._data).toString("hex")},t}(),st=function(){function t(t){this.client=new nt(t)}var e=t.prototype;return e.newTransferCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_transferCoin",[e,r.objectId,r.gasPayment,r.gasBudget,r.recipient],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error transferring coin: "+t.t0+" with args "+r);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newMoveCall=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_moveCall",[e,r.packageObjectId,r.module,r.function,r.typeArguments,r.arguments,r.gasPayment,r.gasBudget],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error executing a move call: "+t.t0+" with args "+r);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newMergeCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_mergeCoins",[e,r.primaryCoin,r.coinToMerge,r.gasPayment,r.gasBudget],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error merging coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),e.newSplitCoin=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.requestWithType("sui_splitCoin",[e,r.coinObjectId,r.splitAmounts,r.gasPayment,r.gasBudget],Q);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error splitting coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),t}(),at=function(t){function e(){return t.apply(this,arguments)||this}d(e,t);var r=e.prototype;return r.getObjectsOwnedByAddress=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getOwnedObjects");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getObject=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getObject");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.getTransaction=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTransaction");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=l(b.mark((function t(e,r,n){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("executeTransaction");case 1:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),r.getTotalTransactionNumber=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTotalTransactionNumber");case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getTransactionDigestsInRange=function(){var t=l(b.mark((function t(e,r){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getTransactionDigestsInRange");case 1:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.getRecentTransactions=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw this.newError("getRecentTransactions");case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.newError=function(t){return new Error("Please use a valid provider for "+t)},e}(h),ct=function(){function t(t,e){this.provider=t||new at;var r="";this.provider instanceof ot&&(r=this.provider.endpoint),this.serializer=e||new st(r)}var e=t.prototype;return e.signAndExecuteTransaction=function(){var t=l(b.mark((function t(e){var r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.signData(e);case 2:return r=t.sent,t.next=5,this.provider.executeTransaction(e.toString(),r.signature.toString(),r.pubKey.toString());case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.transferCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newTransferCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.mergeCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newMergeCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.splitCoin=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newSplitCoin(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.executeMoveCall=function(){var t=l(b.mark((function t(e){var r,n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAddress();case 2:return r=t.sent,t.next=5,this.serializer.newMoveCall(r,e);case 5:return n=t.sent,t.next=8,this.signAndExecuteTransaction(n);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),ft=function(t){function e(e,r,n){var i;return(i=t.call(this,r,n)||this).keypair=e,i}d(e,t);var r=e.prototype;return r.getAddress=function(){var t=l(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.keypair.getPublicKey().toSuiAddress());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.signData=function(){var t=l(b.mark((function t(e){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{signature:this.keypair.signData(e),pubKey:this.keypair.getPublicKey()});case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.connect=function(t){return new e(this.keypair,t)},e}(ct),pt=/^(?:[a-zA-Z0-9+\/]{4})*(?:|(?:[a-zA-Z0-9+\/]{3}=)|(?:[a-zA-Z0-9+\/]{2}==)|(?:[a-zA-Z0-9+\/]{1}===))$/;function ht(t){return function(t){return/^(0x|0X)?[a-fA-F0-9]+$/.test(t)&&t.length%2==0}(t)&&20===function(t){return/^(0x|0X)/.test(t)?(t.length-2)/2:t.length/2}(t)}function yt(t){return"Exists"!==t.status?void 0:t.details}function lt(t){return"Deleted"!==t.status?void 0:t.details}function dt(t){return"NotExists"!==t.status?void 0:t.details}function gt(t){var e;return(null==(e=yt(t))?void 0:e.reference)||lt(t)}function vt(t){var e;return null==(e=bt(t))?void 0:e.type}function wt(t){var e;return null==(e=bt(t))?void 0:e.fields}function bt(t){var e="data"in t?t:yt(t);if("moveObject"===(null==e?void 0:e.data.dataType))return e.data}function xt(t){return t.effects.status}function mt(t){return t.effects.gasUsed}function Tt(t){return"SplitCoinResponse"in t?t.SplitCoinResponse:void 0}function jt(t){return"MergeCoinResponse"in t?t.MergeCoinResponse:void 0}var Et=function(){function t(){}return t.isCoin=function(t){var e,r;return null!=(e=null==(r=vt(t))?void 0:r.startsWith("0x2::coin::Coin"))&&e},t.getBalance=function(e){var r;if(t.isCoin(e)){var n=null==(r=wt(e))?void 0:r.balance;return new i.BN(n,10)}},t.getZero=function(){return new i.BN("0",10)},t}(),At=function(){function t(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}var e=t.prototype;return e.shift=function(t){return this.bytePosition+=t,this},e.read8=function(){var t=this.dataView.getUint8(this.bytePosition);return this.shift(1),new n.BN(t,10)},e.read16=function(){var t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),new n.BN(t,10)},e.read32=function(){var t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),new n.BN(t,10)},e.read64=function(){var t=this.read32(),e=this.read32().toString(16)+t.toString(16).padStart(8,"0");return new n.BN(e,16)},e.read128=function(){var t=this.read64(),e=this.read64().toString(16)+t.toString(16).padStart(8,"0");return new n.BN(e,16)},e.readBytes=function(t){var e=new Uint8Array(this.dataView.buffer,this.bytePosition+this.dataView.byteOffset,t);return this.shift(t),e},e.readULEB=function(){var t=function(t){for(var e=0,r=0,n=0;;){var i=t[n];if(n+=1,e|=(127&i)<<r,0==(128&i))break;r+=7}return{value:e,length:n}}(new Uint8Array(this.dataView.buffer,this.bytePosition+this.dataView.byteOffset)),e=t.value;return this.shift(t.length),e},e.readVec=function(t){for(var e=this.readULEB(),r=[],n=0;n<e;n++)r.push(t(this,n,e));return r},t}(),Ot=function(){function t(t){void 0===t&&(t=1024),this.bytePosition=0,this.dataView=new DataView(new ArrayBuffer(t))}t.toBN=function(t){switch(typeof t){case"bigint":return new n.BN(t.toString());default:return new n.BN(t)}};var e=t.prototype;return e.shift=function(t){return this.bytePosition+=t,this},e.write8=function(e){return this.dataView.setUint8(this.bytePosition,+t.toBN(e)),this.shift(1)},e.write16=function(e){return this.dataView.setUint16(this.bytePosition,+t.toBN(e),!0),this.shift(2)},e.write32=function(e){return this.dataView.setUint32(this.bytePosition,+t.toBN(e),!0),this.shift(4)},e.write64=function(e){var r=this;return t.toBN(e).toArray("le",8).forEach((function(t){return r.write8(t)})),this},e.write128=function(e){var r=this;return t.toBN(e).toArray("le",16).forEach((function(t){return r.write8(t)})),this},e.writeULEB=function(t){var e=this;return function(t){var e=[],r=0;if(0===t)return[0];for(;t>0;)e[r]=127&t,(t>>=7)&&(e[r]|=128),r+=1;return e}(t).forEach((function(t){return e.write8(t)})),this},e.writeVec=function(t,e){var r=this;return this.writeULEB(t.length),Array.from(t).forEach((function(n,i){return e(r,n,i,t.length)})),this},e.toBytes=function(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))},e.toString=function(t){switch(t){case"base64":return new c(this.toBytes()).toString();case"hex":return new ut(this.toBytes()).toString();default:throw new Error("Unsupported encoding, supported values are: base64, hex")}},t}(),St=function(){function t(){}return t.set=function(t,e,r){return void 0===r&&(r=1024),this.getTypeInterface(t).encode(e,r)},t.de=function(t,e){return this.getTypeInterface(t).decode(e)},t.hasType=function(t){return this.types.has(t)},t.registerType=function(t,e,r,n){return void 0===n&&(n=function(){return!0}),this.types.set(t,{encode:function(t,e){return void 0===e&&(e=1024),this._encodeRaw(new Ot(e),t)},decode:function(t){return this._decodeRaw(new At(t))},_encodeRaw:function(r,i){if(n(i))return e(r,i);throw new Error("Validation failed for type "+t+", data: "+i)},_decodeRaw:function(t){return r(t)}}),this},t.registerAddressType=function(t,e){return this.registerType(t,(function(t,e){return new ut(e).getData().reduce((function(t,e){return t.write8(e)}),t)}),(function(t){return new ut(t.readBytes(e)).toString()}))},t.registerVectorType=function(e,r){return this.registerType(e,(function(e,n){return e.writeVec(n,(function(e,n){return t.getTypeInterface(r)._encodeRaw(e,n)}))}),(function(e){return e.readVec((function(e){return t.getTypeInterface(r)._decodeRaw(e)}))}))},t.registerStructType=function(e,r){var n=Object.freeze(r),i=Object.keys(n);return this.registerType(e,(function(e,r){for(var o,u=v(i);!(o=u()).done;){var s=o.value;t.getTypeInterface(n[s])._encodeRaw(e,r[s])}return e}),(function(e){for(var r,o={},u=v(i);!(r=u()).done;){var s=r.value;o[s]=t.getTypeInterface(n[s])._decodeRaw(e)}return o}))},t.registerEnumType=function(e,r){var n=Object.freeze(r),i=Object.keys(n);return this.registerType(e,(function(r,o){var u=Object.keys(o)[0];if(void 0===u)throw new Error("Unknown invariant of the enum "+e);var s=i.indexOf(u);if(-1===s)throw new Error("Unknown invariant of the enum "+e+", allowed values: "+i);var a=n[i[s]];return r.write8(s),null!==a?t.getTypeInterface(a)._encodeRaw(r,o[u]):r}),(function(r){var o,u=r.readULEB(),s=i[u],a=n[s];if(-1===u)throw new Error("Decoding type mismatch, expected enum "+e+" invariant index, received "+u);return(o={})[s]=null===a||t.getTypeInterface(a)._decodeRaw(r),o}))},t.getTypeInterface=function(e){var r=t.types.get(e);if(void 0===r)throw new Error("Type "+e+" is not registered");return r},t}();St.U8="u8",St.U32="u32",St.U64="u64",St.U128="u128",St.BOOL="bool",St.VECTOR="vector",St.ADDRESS="address",St.STRING="string",St.types=new Map,St.registerType(St.U8,(function(t,e){return t.write8(e)}),(function(t){return t.read8()}),(function(t){return t<256})),St.registerType(St.U32,(function(t,e){return t.write32(e)}),(function(t){return t.read32()}),(function(t){return t<4294967296})),St.registerType(St.U64,(function(t,e){return t.write64(e)}),(function(t){return t.read64()}),(function(t){return!0})),St.registerType(St.U128,(function(t,e){return t.write128(e)}),(function(t){return t.read128()}),(function(t){return!0})),St.registerType(St.BOOL,(function(t,e){return t.write8(e)}),(function(t){return"1"==t.read8().toString(10)}),(function(t){return!0})),St.registerType(St.STRING,(function(t,e){return t.writeVec(Array.from(e),(function(t,e){return t.write8(e.charCodeAt(0))}))}),(function(t){return t.readVec((function(t){return t.read8()})).map((function(t){return String.fromCharCode(t)})).join("")}),(function(t){return/^[\x00-\x7F]*$/.test(t)})),exports.BCS={__proto__:null,BcsReader:At,BcsWriter:Ot,BCS:St},exports.Base64DataBuffer=c,exports.Coin=Et,exports.Ed25519Keypair=p,exports.HexDataBuffer=ut,exports.JsonRpcProvider=ot,exports.PUBLIC_KEY_SIZE=32,exports.Provider=h,exports.PublicKey=f,exports.RawSigner=ft,exports.RpcTxnDataSerializer=st,exports.SignerWithProvider=ct,exports.getCoinAfterMerge=function(t){var e;return null==(e=jt(t))?void 0:e.updatedCoin},exports.getCoinAfterSplit=function(t){var e;return null==(e=Tt(t))?void 0:e.updatedCoin},exports.getExecutionStatus=xt,exports.getExecutionStatusError=function(t){return xt(t).error},exports.getExecutionStatusGasSummary=mt,exports.getExecutionStatusType=function(t){return xt(t).status},exports.getMergeCoinResponse=jt,exports.getMoveCallTransaction=function(t){return"Call"in t?t.Call:void 0},exports.getMoveObject=bt,exports.getMoveObjectType=vt,exports.getMovePackageContent=function(t){if("disassembled"in t)return t.disassembled;var e=yt(t);return"package"===(null==e?void 0:e.data.dataType)?e.data.disassembled:void 0},exports.getNewlyCreatedCoinsAfterSplit=function(t){var e;return null==(e=Tt(t))?void 0:e.newCoins},exports.getObjectDeletedResponse=lt,exports.getObjectExistsResponse=yt,exports.getObjectFields=wt,exports.getObjectId=function(t){var e,r;return"objectId"in t?t.objectId:null!=(e=null==(r=gt(t))?void 0:r.objectId)?e:dt(t)},exports.getObjectNotExistsResponse=dt,exports.getObjectOwner=function(t){var e;return null==(e=yt(t))?void 0:e.owner},exports.getObjectPreviousTransactionDigest=function(t){var e;return null==(e=yt(t))?void 0:e.previousTransaction},exports.getObjectReference=gt,exports.getObjectType=function(t){var e;return null==(e=yt(t))?void 0:e.data.dataType},exports.getObjectVersion=function(t){var e;return"version"in t?t.version:null==(e=gt(t))?void 0:e.version},exports.getPublishTransaction=function(t){return"Publish"in t?t.Publish:void 0},exports.getSplitCoinResponse=Tt,exports.getTotalGasUsed=function(t){var e=mt(t);return e.computationCost+e.storageCost-e.storageRebate},exports.getTransactionAuthorityQuorumSignInfo=function(t){return t.authSignInfo},exports.getTransactionData=function(t){return t.data},exports.getTransactionDigest=function(t){return t.transactionDigest},exports.getTransactionEffectsResponse=function(t){return"EffectResponse"in t?t.EffectResponse:void 0},exports.getTransactionGasBudget=function(t){return t.data.gasBudget},exports.getTransactionGasObject=function(t){return t.data.gasPayment},exports.getTransactionKindName=function(t){return Object.keys(t)[0]},exports.getTransactionSender=function(t){return t.data.sender},exports.getTransactionSignature=function(t){return t.txSignature},exports.getTransactions=function(t){return t.data.transactions},exports.getTransferCoinTransaction=function(t){return"TransferCoin"in t?t.TransferCoin:void 0},exports.isAuthorityName=function(t,e){return"string"==typeof t},exports.isAuthorityQuorumSignInfo=V,exports.isAuthoritySignature=function(t,e){return"string"==typeof t},exports.isCertifiedTransaction=M,exports.isEd25519KeypairData=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.publicKey instanceof Uint8Array&&t.secretKey instanceof Uint8Array},exports.isEmptySignInfo=function(t,e){return"object"==typeof t},exports.isEpochId=function(t,e){return"number"==typeof t},exports.isExecutionStatus=G,exports.isExecutionStatusType=W,exports.isGasCostSummary=K,exports.isGatewayTxSeqNumber=function(t,e){return"number"==typeof t},exports.isGetObjectDataResponse=I,exports.isGetOwnedObjectsResponse=_,exports.isGetTxnDigestsResponse=J,exports.isKeypair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getPublicKey&&"function"==typeof t.signData},exports.isMergeCoinResponse=X,exports.isMergeCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.primaryCoin)&&m(t.coinToMerge)&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isMoveCall=$,exports.isMoveCallTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.packageObjectId)&&m(t.module)&&m(t.function)&&Array.isArray(t.typeArguments)&&t.typeArguments.every((function(t){return m(t)}))&&Array.isArray(t.arguments)&&t.arguments.every((function(t){return Y(t)}))&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isMovePackageContent=O,exports.isObjectContentFields=A,exports.isObjectDigest=function(t,e){return"string"==typeof t},exports.isObjectId=function(t,e){return"string"==typeof t},exports.isObjectOwner=T,exports.isObjectStatus=R,exports.isObjectType=P,exports.isOwnedObjectRef=z,exports.isPublicKeyData=x,exports.isPublicKeyInitData=function(t,e){return m(t)||L(t)||t instanceof Buffer||t instanceof Uint8Array||Array.isArray(t)&&t.every((function(t){return L(t)}))||x(t)},exports.isRawAuthoritySignInfo=D,exports.isSequenceNumber=L,exports.isSignaturePubkeyPair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.signature instanceof c&&t.pubKey instanceof f},exports.isSigner=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getAddress&&"function"==typeof t.signData},exports.isSplitCoinResponse=H,exports.isSplitCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.coinObjectId)&&Array.isArray(t.splitAmounts)&&t.splitAmounts.every((function(t){return L(t)}))&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)},exports.isSuiAddress=function(t,e){return"string"==typeof t},exports.isSuiData=S,exports.isSuiJsonValue=Y,exports.isSuiMoveObject=C,exports.isSuiMovePackage=k,exports.isSuiObject=B,exports.isSuiObjectInfo=E,exports.isSuiObjectRef=j,exports.isSuiTransactionKind=q,exports.isTransactionBytes=Q,exports.isTransactionData=U,exports.isTransactionDigest=m,exports.isTransactionEffects=F,exports.isTransactionEffectsResponse=Z,exports.isTransactionKindName=function(t,e){return"TransferCoin"===t||"Publish"===t||"Call"===t},exports.isTransactionResponse=tt,exports.isTransferCoin=N,exports.isTransferCoinTransaction=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&m(t.objectId)&&(void 0===t.gasPayment||m(t.gasPayment))&&L(t.gasBudget)&&m(t.recipient)},exports.isTxnDataSerializer=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.newTransferCoin&&"function"==typeof t.newMoveCall&&"function"==typeof t.newMergeCoin&&"function"==typeof t.newSplitCoin},exports.isValidSuiAddress=ht,exports.isValidSuiObjectId=function(t){return ht(t)},exports.isValidTransactionDigest=function(t){return 32===new c(t).getLength()&&pt.test(t)};
"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)&&_(t.dataType)&&A(t)||(null!==t&&"object"==typeof t||"function"==typeof t)&&_(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 _(t,e){return"moveObject"===t||"package"===t}function P(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 D(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)&&V(t.Call)}function I(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&Array.isArray(t.transactions)&&t.transactions.every((function(t){return D(t)}))&&x(t.sender)&&m(t.gasPayment)&&B(t.gasBudget)}function L(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 M(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.transactionDigest)&&I(t.data)&&x(t.txSignature)&&L(t.authSignInfo)}function N(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&B(t.computationCost)&&B(t.storageCost)&&B(t.storageRebate)}function K(t,e){return"success"===t||"failure"===t}function W(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&K(t.status)&&(void 0===t.error||x(t.error))}function G(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&w(t.owner)&&m(t.reference)}function F(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&W(t.status)&&N(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 G(t)})))&&(void 0===t.mutated||Array.isArray(t.mutated)&&t.mutated.every((function(t){return G(t)})))&&(void 0===t.unwrapped||Array.isArray(t.unwrapped)&&t.unwrapped.every((function(t){return G(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)})))&&G(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 z(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&F(t.effects)&&(null===t.timestamp_ms||B(t.timestamp_ms))}function U(t,e){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&B(t[0])&&x(t[1])}))}function V(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 Z(t)})))}function Z(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 J(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&x(t.txBytes)&&m(t.gas)}function Y(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&k(t.updatedCoin)&&k(t.updatedGas)}function Q(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&M(t.certificate)&&k(t.updatedCoin)&&Array.isArray(t.newCoins)&&t.newCoins.every((function(t){return k(t)}))&&k(t.updatedGas)}function X(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&z(t.EffectResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&Q(t.SplitCoinResponse)||(null!==t&&"object"==typeof t||"function"==typeof t)&&Y(t.MergeCoinResponse)}function $(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"2.0"===t.jsonrpc&&x(t.id)}var H=require("lossless-json"),tt=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(H.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(!$(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 $(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}(),et=function(t){return"number"==typeof t},rt=function(t){function e(e){var r;return(r=t.call(this)||this).endpoint=e,r.client=new tt(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],P);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],P);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,U);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,U);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],z);case 3:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error getting transaction with effects: "+t.t0+" for digest "+e);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),r.getTransactionWithEffectsBatch=function(){var t=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,z);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(1),n=e.join(", ").substring(0,-2),new Error("Error getting transaction effects: "+t.t0+" for digests ["+n+"]");case 11:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e){return t.apply(this,arguments)}}(),r.executeTransaction=function(){var t=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],X);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",[],et);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],U);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],U);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),nt=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}(),ot=function(){function t(t){this.client=new tt(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],J);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],J);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],J);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],J);case 3:return t.abrupt("return",new c(t.sent.txBytes));case 7:throw t.prev=7,t.t0=t.catch(0),new Error("Error splitting coin: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])})));return function(e,r){return t.apply(this,arguments)}}(),t}(),it=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),st=function(){function t(t,e){this.provider=t||new it;var r="";this.provider instanceof rt&&(r=this.provider.endpoint),this.serializer=e||new ot(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)}}(),t}(),ut=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}(st),at=/^(?:[a-zA-Z0-9+\/]{4})*(?:|(?:[a-zA-Z0-9+\/]{3}=)|(?:[a-zA-Z0-9+\/]{2}==)|(?:[a-zA-Z0-9+\/]{1}===))$/;function ct(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 ft(t){return"Exists"!==t.status?void 0:t.details}function pt(t){return"Deleted"!==t.status?void 0:t.details}function lt(t){return"NotExists"!==t.status?void 0:t.details}function ht(t){var e;return(null==(e=ft(t))?void 0:e.reference)||pt(t)}function yt(t){var e;return null==(e=gt(t))?void 0:e.type}function dt(t){var e;return null==(e=gt(t))?void 0:e.fields}function gt(t){var e="data"in t?t:ft(t);if("moveObject"===(null==e?void 0:e.data.dataType))return e.data}function vt(t){return t.effects.status}function bt(t){return t.effects.gasUsed}function xt(t){return"SplitCoinResponse"in t?t.SplitCoinResponse:void 0}function wt(t){return"MergeCoinResponse"in t?t.MergeCoinResponse:void 0}var mt=function(){function t(){}return t.isCoin=function(t){var e,r;return null!=(e=null==(r=yt(t))?void 0:r.startsWith("0x2::coin::Coin"))&&e},t.getBalance=function(e){var r;if(t.isCoin(e)){var n=null==(r=dt(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=mt,exports.Ed25519Keypair=p,exports.HexDataBuffer=nt,exports.JsonRpcProvider=rt,exports.PUBLIC_KEY_SIZE=32,exports.Provider=l,exports.PublicKey=f,exports.RawSigner=ut,exports.RpcTxnDataSerializer=ot,exports.SignerWithProvider=st,exports.getCoinAfterMerge=function(t){var e;return null==(e=wt(t))?void 0:e.updatedCoin},exports.getCoinAfterSplit=function(t){var e;return null==(e=xt(t))?void 0:e.updatedCoin},exports.getExecutionStatus=vt,exports.getExecutionStatusError=function(t){return vt(t).error},exports.getExecutionStatusGasSummary=bt,exports.getExecutionStatusType=function(t){return vt(t).status},exports.getMergeCoinResponse=wt,exports.getMoveCallTransaction=function(t){return"Call"in t?t.Call:void 0},exports.getMoveObject=gt,exports.getMoveObjectType=yt,exports.getMovePackageContent=function(t){if("disassembled"in t)return t.disassembled;var e=ft(t);return"package"===(null==e?void 0:e.data.dataType)?e.data.disassembled:void 0},exports.getNewlyCreatedCoinsAfterSplit=function(t){var e;return null==(e=xt(t))?void 0:e.newCoins},exports.getObjectDeletedResponse=pt,exports.getObjectExistsResponse=ft,exports.getObjectFields=dt,exports.getObjectId=function(t){var e,r;return"objectId"in t?t.objectId:null!=(e=null==(r=ht(t))?void 0:r.objectId)?e:lt(t)},exports.getObjectNotExistsResponse=lt,exports.getObjectOwner=function(t){var e;return null==(e=ft(t))?void 0:e.owner},exports.getObjectPreviousTransactionDigest=function(t){var e;return null==(e=ft(t))?void 0:e.previousTransaction},exports.getObjectReference=ht,exports.getObjectType=function(t){var e;return null==(e=ft(t))?void 0:e.data.dataType},exports.getObjectVersion=function(t){var e;return"version"in t?t.version:null==(e=ht(t))?void 0:e.version},exports.getPublishTransaction=function(t){return"Publish"in t?t.Publish:void 0},exports.getSplitCoinResponse=xt,exports.getTotalGasUsed=function(t){var e=bt(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.hasPublicTransfer=function(t){var e,r;return null!=(e=null==(r=gt(t))?void 0:r.has_public_transfer)&&e},exports.isAuthorityName=function(t,e){return"string"==typeof t},exports.isAuthorityQuorumSignInfo=L,exports.isAuthoritySignature=function(t,e){return"string"==typeof t},exports.isCertifiedTransaction=M,exports.isEd25519KeypairData=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&t.publicKey instanceof Uint8Array&&t.secretKey instanceof Uint8Array},exports.isEmptySignInfo=function(t,e){return"object"==typeof t},exports.isEpochId=function(t,e){return"number"==typeof t},exports.isExecutionStatus=W,exports.isExecutionStatusType=K,exports.isGasCostSummary=N,exports.isGatewayTxSeqNumber=function(t,e){return"number"==typeof t},exports.isGetObjectDataResponse=R,exports.isGetOwnedObjectsResponse=P,exports.isGetTxnDigestsResponse=U,exports.isKeypair=function(t,e){return(null!==t&&"object"==typeof t||"function"==typeof t)&&"function"==typeof t.getPublicKey&&"function"==typeof t.signData},exports.isMergeCoinResponse=Y,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=V,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 Z(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=_,exports.isOwnedObjectRef=G,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.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=Q,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.isSuiData=O,exports.isSuiJsonValue=Z,exports.isSuiMoveObject=A,exports.isSuiMovePackage=S,exports.isSuiObject=k,exports.isSuiObjectInfo=j,exports.isSuiObjectRef=m,exports.isSuiTransactionKind=D,exports.isTransactionBytes=J,exports.isTransactionData=I,exports.isTransactionDigest=x,exports.isTransactionEffects=F,exports.isTransactionEffectsResponse=z,exports.isTransactionKindName=function(t,e){return"TransferObject"===t||"Publish"===t||"Call"===t},exports.isTransactionResponse=X,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},exports.isValidSuiAddress=ct,exports.isValidSuiObjectId=function(t){return ct(t)},exports.isValidTransactionDigest=function(t){return 32===new c(t).getLength()&&at.test(t)};
//# sourceMappingURL=sui.js.cjs.production.min.js.map

@@ -26,2 +26,3 @@ import { ObjectOwner } from './common';

fields: ObjectContentFields;
has_public_transfer: boolean;
};

@@ -69,2 +70,3 @@ export declare type SuiMovePackage = {

export declare function getMoveObject(data: GetObjectDataResponse | SuiObject): SuiMoveObject | undefined;
export declare function hasPublicTransfer(data: GetObjectDataResponse | SuiObject): boolean;
export declare function getMovePackageContent(data: GetObjectDataResponse | SuiMovePackage): MovePackageContent | undefined;
import { ObjectOwner, SuiAddress, TransactionDigest } from './common';
import { SuiMovePackage, SuiObject, SuiObjectRef } from './objects';
export declare type TransferCoin = {
export declare type TransferObject = {
recipient: SuiAddress;
objectRef: SuiObjectRef;
};
export declare type RawAuthoritySignInfo = [AuthorityName, AuthoritySignature];
export declare type TransactionKindName = 'TransferCoin' | 'Publish' | 'Call';
export declare type TransactionKindName = 'TransferObject' | 'Publish' | 'Call';
export declare type SuiTransactionKind = {
TransferCoin: TransferCoin;
TransferObject: TransferObject;
} | {

@@ -25,3 +24,3 @@ Publish: SuiMovePackage;

epoch: EpochId;
signatures: RawAuthoritySignInfo[];
signatures: AuthoritySignature[];
};

@@ -83,2 +82,3 @@ export declare type CertifiedTransaction = {

effects: TransactionEffects;
timestamp_ms: number | null;
};

@@ -127,3 +127,3 @@ export declare type GatewayTxSeqNumber = number;

export declare function getTransactionGasBudget(tx: CertifiedTransaction): number;
export declare function getTransferCoinTransaction(data: SuiTransactionKind): TransferCoin | undefined;
export declare function getTransferObjectTransaction(data: SuiTransactionKind): TransferObject | undefined;
export declare function getPublishTransaction(data: SuiTransactionKind): SuiMovePackage | undefined;

@@ -130,0 +130,0 @@ export declare function getMoveCallTransaction(data: SuiTransactionKind): MoveCall | undefined;

{
"version": "0.4.0",
"version": "0.6.0",
"license": "Apache-2.0",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -83,3 +83,3 @@ # Sui TypeScript SDK

);
const transferTxn = await signer.transferCoin({
const transferTxn = await signer.transferObject({
objectId: '0x5015b016ab570df14c87649eda918e09e5cc61e0',

@@ -86,0 +86,0 @@ gasBudget: 1000,

@@ -8,3 +8,3 @@ // Copyright (c) 2022, Mysten Labs, Inc.

*/
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferCoinTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferCoin, RawAuthoritySignInfo, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index";
import { Ed25519KeypairData, Keypair, PublicKeyInitData, PublicKeyData, TransferObjectTransaction, MergeCoinTransaction, SplitCoinTransaction, MoveCallTransaction, TxnDataSerializer, SignaturePubkeyPair, Signer, TransactionDigest, SuiAddress, ObjectOwner, SuiObjectRef, SuiObjectInfo, ObjectContentFields, MovePackageContent, SuiData, SuiMoveObject, SuiMovePackage, SuiObject, ObjectStatus, ObjectType, GetOwnedObjectsResponse, GetObjectDataResponse, ObjectDigest, ObjectId, SequenceNumber, TransferObject, TransactionKindName, SuiTransactionKind, TransactionData, EpochId, AuthorityQuorumSignInfo, CertifiedTransaction, GasCostSummary, ExecutionStatusType, ExecutionStatus, OwnedObjectRef, TransactionEffects, TransactionEffectsResponse, GatewayTxSeqNumber, GetTxnDigestsResponse, MoveCall, SuiJsonValue, EmptySignInfo, AuthorityName, AuthoritySignature, TransactionBytes, MergeCoinResponse, SplitCoinResponse, TransactionResponse } from "./index";
import { BN } from "bn.js";

@@ -57,3 +57,3 @@ import { Base64DataBuffer } from "./serialization/base64";

export function isTransferCoinTransaction(obj: any, _argumentName?: string): obj is TransferCoinTransaction {
export function isTransferObjectTransaction(obj: any, _argumentName?: string): obj is TransferObjectTransaction {
return (

@@ -127,3 +127,3 @@ (obj !== null &&

typeof obj === "function") &&
typeof obj.newTransferCoin === "function" &&
typeof obj.newTransferObject === "function" &&
typeof obj.newMoveCall === "function" &&

@@ -251,3 +251,4 @@ typeof obj.newMergeCoin === "function" &&

isTransactionDigest(obj.type) as boolean &&
isObjectContentFields(obj.fields) as boolean
isObjectContentFields(obj.fields) as boolean &&
typeof obj.has_public_transfer === "boolean"
)

@@ -332,3 +333,3 @@ }

export function isTransferCoin(obj: any, _argumentName?: string): obj is TransferCoin {
export function isTransferObject(obj: any, _argumentName?: string): obj is TransferObject {
return (

@@ -343,13 +344,5 @@ (obj !== null &&

export function isRawAuthoritySignInfo(obj: any, _argumentName?: string): obj is RawAuthoritySignInfo {
return (
Array.isArray(obj) &&
isTransactionDigest(obj[0]) as boolean &&
isTransactionDigest(obj[1]) as boolean
)
}
export function isTransactionKindName(obj: any, _argumentName?: string): obj is TransactionKindName {
return (
(obj === "TransferCoin" ||
(obj === "TransferObject" ||
obj === "Publish" ||

@@ -365,3 +358,3 @@ obj === "Call")

typeof obj === "function") &&
isTransferCoin(obj.TransferCoin) as boolean ||
isTransferObject(obj.TransferObject) as boolean ||
(obj !== null &&

@@ -407,3 +400,3 @@ typeof obj === "object" ||

obj.signatures.every((e: any) =>
isRawAuthoritySignInfo(e) as boolean
isTransactionDigest(e) as boolean
)

@@ -519,3 +512,5 @@ )

isCertifiedTransaction(obj.certificate) as boolean &&
isTransactionEffects(obj.effects) as boolean
isTransactionEffects(obj.effects) as boolean &&
(obj.timestamp_ms === null ||
isSequenceNumber(obj.timestamp_ms) as boolean)
)

@@ -522,0 +517,0 @@ }

@@ -23,3 +23,1 @@ // Copyright (c) 2022, Mysten Labs, Inc.

export * from './index.guard';
export * as BCS from './bcs';

@@ -15,3 +15,3 @@ // Copyright (c) 2022, Mysten Labs, Inc.

SplitCoinTransaction,
TransferCoinTransaction,
TransferObjectTransaction,
TxnDataSerializer,

@@ -70,9 +70,9 @@ } from './txn-data-serializers/txn-data-serializer';

/**
* Serialize and Sign a `TransferCoin` transaction and submit to the Gateway for execution
* Serialize and Sign a `TransferObject` transaction and submit to the Gateway for execution
*/
async transferCoin(
transaction: TransferCoinTransaction
async transferObject(
transaction: TransferObjectTransaction
): Promise<TransactionResponse> {
const signerAddress = await this.getAddress();
const txBytes = await this.serializer.newTransferCoin(
const txBytes = await this.serializer.newTransferObject(
signerAddress,

@@ -79,0 +79,0 @@ transaction

@@ -12,3 +12,3 @@ // Copyright (c) 2022, Mysten Labs, Inc.

SplitCoinTransaction,
TransferCoinTransaction,
TransferObjectTransaction,
TxnDataSerializer,

@@ -36,9 +36,9 @@ } from './txn-data-serializer';

async newTransferCoin(
async newTransferObject(
signerAddress: SuiAddress,
t: TransferCoinTransaction
t: TransferObjectTransaction
): Promise<Base64DataBuffer> {
try {
const resp = await this.client.requestWithType(
'sui_transferCoin',
'sui_transferObject',
[signerAddress, t.objectId, t.gasPayment, t.gasBudget, t.recipient],

@@ -45,0 +45,0 @@ isTransactionBytes

@@ -9,3 +9,3 @@ // Copyright (c) 2022, Mysten Labs, Inc.

// Exported Types
export interface TransferCoinTransaction {
export interface TransferObjectTransaction {
objectId: ObjectId;

@@ -47,5 +47,5 @@ gasPayment?: ObjectId;

export interface TxnDataSerializer {
newTransferCoin(
newTransferObject(
signerAddress: SuiAddress,
txn: TransferCoinTransaction
txn: TransferObjectTransaction
): Promise<Base64DataBuffer>;

@@ -52,0 +52,0 @@

@@ -36,2 +36,3 @@ // Copyright (c) 2022, Mysten Labs, Inc.

fields: ObjectContentFields;
has_public_transfer: boolean;
};

@@ -170,2 +171,8 @@

export function hasPublicTransfer(
data: GetObjectDataResponse | SuiObject
): boolean {
return getMoveObject(data)?.has_public_transfer ?? false;
}
export function getMovePackageContent(

@@ -172,0 +179,0 @@ data: GetObjectDataResponse | SuiMovePackage

@@ -7,11 +7,10 @@ // Copyright (c) 2022, Mysten Labs, Inc.

export type TransferCoin = {
export type TransferObject = {
recipient: SuiAddress;
objectRef: SuiObjectRef;
};
export type RawAuthoritySignInfo = [AuthorityName, AuthoritySignature];
export type TransactionKindName = 'TransferCoin' | 'Publish' | 'Call';
export type TransactionKindName = 'TransferObject' | 'Publish' | 'Call';
export type SuiTransactionKind =
| { TransferCoin: TransferCoin }
| { TransferObject: TransferObject }
| { Publish: SuiMovePackage }

@@ -31,3 +30,3 @@ | { Call: MoveCall };

epoch: EpochId;
signatures: RawAuthoritySignInfo[];
signatures: AuthoritySignature[];
};

@@ -97,2 +96,3 @@

effects: TransactionEffects;
timestamp_ms: number | null;
};

@@ -194,6 +194,6 @@

export function getTransferCoinTransaction(
export function getTransferObjectTransaction(
data: SuiTransactionKind
): TransferCoin | undefined {
return 'TransferCoin' in data ? data.TransferCoin : undefined;
): TransferObject | undefined {
return 'TransferObject' in data ? data.TransferObject : undefined;
}

@@ -200,0 +200,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc