@aptos-labs/js-pro 0.1.0-beta.0 → 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dist/client.d.ts +9 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/index.js +56 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -31
- package/dist/index.mjs.map +1 -1
- package/dist/mutations/signAndSubmitTransaction.d.ts +2 -2
- package/dist/mutations/signAndSubmitTransaction.d.ts.map +1 -1
- package/dist/operations/generated/operations.d.ts +47 -0
- package/dist/operations/generated/operations.d.ts.map +1 -1
- package/dist/operations/generated/sdk.d.ts +3 -0
- package/dist/operations/generated/sdk.d.ts.map +1 -1
- package/dist/operations/generated/types.d.ts +18 -18
- package/dist/operations/generated/types.d.ts.map +1 -1
- package/dist/operations/index.d.ts +1 -0
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/queries/fetchEvents.d.ts +7 -0
- package/dist/queries/fetchEvents.d.ts.map +1 -0
- package/dist/queries/fetchUserTransactions.d.ts +16 -0
- package/dist/queries/fetchUserTransactions.d.ts.map +1 -0
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources.d.ts +22 -0
- package/dist/types/resources.d.ts.map +1 -1
- package/dist/types/signers.d.ts +27 -3
- package/dist/types/signers.d.ts.map +1 -1
- package/dist/types/transactions.d.ts +12 -0
- package/dist/types/transactions.d.ts.map +1 -1
- package/dist/utils/explorer.d.ts +2 -1
- package/dist/utils/explorer.d.ts.map +1 -1
- package/dist/utils/normalize.d.ts +3 -2
- package/dist/utils/normalize.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/client.ts +33 -8
- package/src/mutations/signAndSubmitTransaction.ts +11 -3
- package/src/operations/generated/operations.ts +14 -2
- package/src/operations/generated/sdk.ts +31 -3
- package/src/operations/generated/types.ts +18 -18
- package/src/operations/schemas/account.gql +29 -2
- package/src/queries/fetchEvents.ts +23 -0
- package/src/queries/fetchUserTransactions.ts +56 -0
- package/src/queries/index.ts +2 -0
- package/src/types/index.ts +2 -0
- package/src/types/resources.ts +16 -0
- package/src/types/signers.ts +35 -3
- package/src/types/transactions.ts +13 -0
- package/src/utils/explorer.ts +3 -1
- package/src/utils/normalize.ts +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,59 @@
|
|
|
1
1
|
# @aptos-labs/js-pro
|
|
2
|
+
|
|
3
|
+
## 0.1.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fd5339d: Add paginated fetchUserTransactions query and allow useClients to specify network
|
|
8
|
+
|
|
9
|
+
## 0.1.0-beta.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e457314: Add new AdapterSignerClient
|
|
14
|
+
|
|
15
|
+
## 0.1.0-beta.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 3ab379b: Fix `useAddressFromName` and `useNameFromAddress` resolving to `undefined` instead of `null`
|
|
20
|
+
- b6c39c8: Allow network specific API keys
|
|
21
|
+
|
|
22
|
+
## 0.1.0-beta.7
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- bcfa4c8: ANS resolution hooks now accept `undefined` `address` or `name`
|
|
27
|
+
|
|
28
|
+
## 0.1.0-beta.6
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- ff32dd0: Fix missing query keys for useSimulateTransaction
|
|
33
|
+
|
|
34
|
+
## 0.1.0-beta.5
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 1b533f3: Add sender to useSimulateTransaction and added more resource types
|
|
39
|
+
|
|
40
|
+
## 0.1.0-beta.4
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- 7ebca81: Fix explorer url to accept pathname
|
|
45
|
+
- 364ad41: Add `useEvents` hook
|
|
46
|
+
|
|
47
|
+
## 0.1.0-beta.3
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- f57c51a: `useAccountTransactions` will now provide the entryFunction
|
|
52
|
+
|
|
53
|
+
## 0.1.0-beta.2
|
|
54
|
+
|
|
55
|
+
## 0.1.0-beta.1
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- 4fb9cb5: Default queries/mutations to use empty object if possible
|
package/dist/client.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { StoreApi } from "zustand/vanilla";
|
|
2
|
-
import { Aptos, AptosSettings } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import { Aptos, AptosSettings, Network } from "@aptos-labs/ts-sdk";
|
|
3
3
|
import { GraphQLClient } from "graphql-request";
|
|
4
4
|
import { Sdk } from "./operations/index.js";
|
|
5
5
|
import { AccountInfo, NetworkInfo, SignerClient } from "./types/index.js";
|
|
6
|
-
import { getClients, fetchAccountCoins, fetchAptBalance, fetchBalance, fetchProcessorStatus, fetchAddressFromName, fetchNameFromAddress, fetchEstimatedGasPrice, fetchTransaction, fetchResources, fetchResourceType, fetchTokenData, fetchFungibleAssetMetadata, fetchAccountCollections, fetchViewModule, fetchLedgerInfo } from "./queries/index.js";
|
|
6
|
+
import { getClients, fetchAccountCoins, fetchAptBalance, fetchBalance, fetchProcessorStatus, fetchAddressFromName, fetchNameFromAddress, fetchEstimatedGasPrice, fetchTransaction, fetchResources, fetchResourceType, fetchTokenData, fetchFungibleAssetMetadata, fetchAccountCollections, fetchViewModule, fetchLedgerInfo, fetchEvents, fetchAccountTransactions, fetchAccountTokens, fetchUserTransactions } from "./queries/index.js";
|
|
7
7
|
import { buildTransaction, signAndSubmitTransaction, signTransaction, simulateTransaction, submitTransaction, waitForTransaction } from "./mutations/index.js";
|
|
8
|
-
import { fetchAccountTokens } from "./queries/fetchAccountTokens.js";
|
|
9
|
-
import { fetchAccountTransactions } from "./queries/fetchAccountTransactions.js";
|
|
10
8
|
type IndexerClientOptions = ConstructorParameters<typeof GraphQLClient>[1];
|
|
11
9
|
export type ClientConfigs = {
|
|
12
10
|
/**
|
|
@@ -20,7 +18,9 @@ export type ClientConfigs = {
|
|
|
20
18
|
* It is okay to accept a single argument here because it is standard to use the same
|
|
21
19
|
* API key for both APIs (node and indexer APIs).
|
|
22
20
|
*/
|
|
23
|
-
apiKey?:
|
|
21
|
+
apiKey?: {
|
|
22
|
+
[network: string | Network]: string;
|
|
23
|
+
} | string;
|
|
24
24
|
/**
|
|
25
25
|
* Will override any Network settings if provided in this config.
|
|
26
26
|
*/
|
|
@@ -63,7 +63,7 @@ export declare class AptosJSProClient {
|
|
|
63
63
|
} | undefined): () => void;
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
get signer():
|
|
66
|
+
get signer(): SignerClient | undefined;
|
|
67
67
|
get account(): AccountInfo | undefined;
|
|
68
68
|
get network(): NetworkInfo;
|
|
69
69
|
get aptos(): Aptos;
|
|
@@ -77,6 +77,7 @@ export declare class AptosJSProClient {
|
|
|
77
77
|
getTokenActivities(variables: import("./operations/index.js").GetTokenActivitiesQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetTokenActivitiesQuery>;
|
|
78
78
|
getTokenAcquisitionActivity(variables: import("./operations/index.js").GetTokenAcquisitionActivityQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetTokenAcquisitionActivityQuery>;
|
|
79
79
|
getAccountTransactions(variables: import("./operations/index.js").GetAccountTransactionsQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetAccountTransactionsQuery>;
|
|
80
|
+
getUserTransactions(variables: import("./operations/index.js").GetUserTransactionsQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetUserTransactionsQuery>;
|
|
80
81
|
getFungibleAssetMetadata(variables: import("./operations/index.js").GetFungibleAssetMetadataQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetFungibleAssetMetadataQuery>;
|
|
81
82
|
getFungibleAssetBalances(variables?: import("./operations/index.js").GetFungibleAssetBalancesQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetFungibleAssetBalancesQuery>;
|
|
82
83
|
getDelegatedStakingRoyalties(variables: import("./operations/index.js").GetDelegatedStakingRoyaltiesQueryVariables, requestHeaders?: HeadersInit | undefined): Promise<import("./operations/index.js").GetDelegatedStakingRoyaltiesQuery>;
|
|
@@ -122,6 +123,8 @@ export declare class AptosJSProClient {
|
|
|
122
123
|
fetchBalance: typeof fetchBalance;
|
|
123
124
|
fetchEstimatedGasPrice: typeof fetchEstimatedGasPrice;
|
|
124
125
|
fetchViewModule: typeof fetchViewModule;
|
|
126
|
+
fetchEvents: typeof fetchEvents;
|
|
127
|
+
fetchUserTransactions: typeof fetchUserTransactions;
|
|
125
128
|
submitTransaction: typeof submitTransaction;
|
|
126
129
|
waitForTransaction: typeof waitForTransaction;
|
|
127
130
|
simulateTransaction: typeof simulateTransaction;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,KAAK,EAGL,aAAa,EACb,OAAO,EACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAuB,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,KAAK,oBAAoB,GAAG,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAC1D;;OAEG;IACH,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,aAAa,CAAA;KAAE,CAAC;IAClC,aAAa,CAAC,EAAE;QAAE,OAAO,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAClD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,qBAAa,gBAAgB;;gBAUf,MAAM,EAAE,0BAA0B;IAkB9C,IAAI,KAAK,0BAER;IAED,IAAI,KAAK;;;;;;;;MAER;IAED,IAAI,MAAM,6BAET;IAED,IAAI,OAAO,4BAEV;IAED,IAAI,OAAO,gBAEV;IAED,IAAI,KAAK,UAER;IAED,IAAI,OAAO;;;;;;;;;;;;;;;;;kBAEV;IAED,aAAa,eAAuD;IAEpE,aAAa,aAAwC;IAErD,UAAU,GAAI,SAAS,WAAW,GAAG,SAAS,UAE5C;IAEF,UAAU,GAAI,SAAS,WAAW,UAGhC;IAEF,SAAS,GAAI,QAAQ,YAAY,GAAG,SAAS,UAE3C;IAEF,SAAS,GAAI,QAAQ,aAAa,UAGhC;IAEF,eAAe,GAAI,UAAU,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,IAAI,gBAIxD;IAEJ,eAAe,GAAI,UAAU,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,gBAIvD;IAEJ,cAAc,GAAI,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,gBAIvD;IAEJ,cAAc,GAAI,UAAU,CAAC,MAAM,CAAC,EAAE,aAAa,KAAK,IAAI,gBAIxD;IAEJ,QAAQ,GAAI,UAAU,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,gBACR;IAEpD,mBAAmB,GACjB,UAAS,WAAgC,KACxC,aAAa,CAYd;IAEF;;;;OAIG;IACH,WAAW,GACT,eAAe,aAAa,EAC5B,UAAS,WAAgC,WA8BzC;IAEF,aAAa,GACX,eAAe,aAAa,EAC5B,UAAS,WAAgC,KACxC,GAAG,GAAG,SAAS,CAyBhB;IAEF,OAAO,CAAC,cAAc,CAGpB;IAIF,UAAU,oBAAc;IAExB,wBAAwB,kCAA4B;IAEpD,uBAAuB,iCAA2B;IAElD,iBAAiB,2BAAqB;IAEtC,kBAAkB,4BAAsB;IAExC,gBAAgB,0BAAoB;IAEpC,cAAc,wBAAkB;IAEhC,iBAAiB,2BAAqB;IAEtC,oBAAoB,8BAAwB;IAE5C,cAAc,wBAAkB;IAEhC,0BAA0B,oCAA8B;IAExD,eAAe,yBAAmB;IAElC,oBAAoB,8BAAwB;IAE5C,oBAAoB,8BAAwB;IAE5C,eAAe,yBAAmB;IAElC,YAAY,sBAAgB;IAE5B,sBAAsB,gCAA0B;IAEhD,eAAe,yBAAmB;IAElC,WAAW,qBAAe;IAE1B,qBAAqB,+BAAyB;IAI9C,iBAAiB,2BAAqB;IAEtC,kBAAkB,4BAAsB;IAExC,mBAAmB,6BAAuB;IAE1C,eAAe,yBAAmB;IAElC,wBAAwB,kCAA4B;IAEpD,gBAAgB,0BAAoB;CACrC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var
|
|
1
|
+
"use strict";var $=Object.defineProperty;var aa=Object.getOwnPropertyDescriptor;var ra=Object.getOwnPropertyNames;var na=Object.prototype.hasOwnProperty;var St=t=>{throw TypeError(t)};var _a=(t,a)=>{for(var e in a)$(t,e,{get:a[e],enumerable:!0})},oa=(t,a,e,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of ra(a))!na.call(t,n)&&n!==e&&$(t,n,{get:()=>a[n],enumerable:!(r=aa(a,n))||r.enumerable});return t};var sa=t=>oa($({},"__esModule",{value:!0}),t);var vt=(t,a,e)=>a.has(t)||St("Cannot "+e);var M=(t,a,e)=>(vt(t,a,"read from private field"),e?e.call(t):a.get(t)),f=(t,a,e)=>a.has(t)?St("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),k=(t,a,e,r)=>(vt(t,a,"write to private field"),r?r.call(t,e):a.set(t,e),e);var La={};_a(La,{Account_Transactions_Select_Column:()=>Ot,Address_Events_Summary_Select_Column:()=>ht,Address_Version_From_Events_Select_Column:()=>ft,Address_Version_From_Move_Resources_Select_Column:()=>Tt,AptosBaseError:()=>C,AptosJSProClient:()=>It,AptosName:()=>E,Block_Metadata_Transactions_Select_Column:()=>Et,Coin_Activities_Select_Column:()=>Ft,Coin_Activities_Select_Column_Coin_Activities_Aggregate_Bool_Exp_Bool_And_Arguments_Columns:()=>wt,Coin_Activities_Select_Column_Coin_Activities_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns:()=>Vt,Coin_Balances_Select_Column:()=>Pt,Coin_Infos_Select_Column:()=>Rt,Coin_Supply_Select_Column:()=>Dt,Collection_Datas_Select_Column:()=>Nt,Current_Ans_Lookup_Select_Column:()=>qt,Current_Ans_Lookup_V2_Select_Column:()=>Qt,Current_Aptos_Names_Select_Column:()=>Lt,Current_Aptos_Names_Select_Column_Current_Aptos_Names_Aggregate_Bool_Exp_Bool_And_Arguments_Columns:()=>$t,Current_Aptos_Names_Select_Column_Current_Aptos_Names_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns:()=>Gt,Current_Coin_Balances_Select_Column:()=>Ut,Current_Collection_Datas_Select_Column:()=>zt,Current_Collection_Ownership_V2_View_Select_Column:()=>jt,Current_Collections_V2_Select_Column:()=>Jt,Current_Delegated_Staking_Pool_Balances_Select_Column:()=>Ht,Current_Delegated_Voter_Select_Column:()=>Wt,Current_Delegator_Balances_Select_Column:()=>Kt,Current_Fungible_Asset_Balances_Select_Column:()=>Xt,Current_Objects_Select_Column:()=>Zt,Current_Staking_Pool_Voter_Select_Column:()=>Yt,Current_Table_Items_Select_Column:()=>te,Current_Token_Datas_Select_Column:()=>ee,Current_Token_Datas_V2_Select_Column:()=>ae,Current_Token_Ownerships_Select_Column:()=>re,Current_Token_Ownerships_V2_Select_Column:()=>ne,Current_Token_Ownerships_V2_Select_Column_Current_Token_Ownerships_V2_Aggregate_Bool_Exp_Bool_And_Arguments_Columns:()=>_e,Current_Token_Ownerships_V2_Select_Column_Current_Token_Ownerships_V2_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns:()=>oe,Current_Token_Pending_Claims_Select_Column:()=>se,Current_Token_Royalty_V1_Select_Column:()=>ie,Cursor_Ordering:()=>pe,Delegated_Staking_Activities_Select_Column:()=>ue,Delegated_Staking_Pool_Balances_Select_Column:()=>ye,Delegated_Staking_Pools_Select_Column:()=>ce,Delegator_Distinct_Pool_Select_Column:()=>le,Events_Select_Column:()=>de,Fungible_Asset_Activities_Select_Column:()=>be,Fungible_Asset_Metadata_Select_Column:()=>me,IndexerNotInitializedError:()=>A,Indexer_Status_Select_Column:()=>ge,Ledger_Infos_Select_Column:()=>Me,Move_Resources_Select_Column:()=>Ie,Nft_Metadata_Crawler_Parsed_Asset_Uris_Select_Column:()=>Se,Num_Active_Delegator_Per_Pool_Select_Column:()=>ve,Order_By:()=>N,Processor_Status_Select_Column:()=>Ae,Proposal_Votes_Select_Column:()=>xe,SenderNotFoundError:()=>D,Signatures_Select_Column:()=>Be,SignerNotFoundError:()=>T,Table_Items_Select_Column:()=>ke,Table_Metadatas_Select_Column:()=>Ce,Token_Activities_Select_Column:()=>Oe,Token_Activities_V2_Select_Column:()=>he,Token_Activities_V2_Select_Column_Token_Activities_V2_Aggregate_Bool_Exp_Bool_And_Arguments_Columns:()=>fe,Token_Activities_V2_Select_Column_Token_Activities_V2_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns:()=>Te,Token_Datas_Select_Column:()=>Ee,Token_Ownerships_Select_Column:()=>Fe,Tokens_Select_Column:()=>we,User_Transactions_Select_Column:()=>Ve,buildTransaction:()=>lt,convertAptosAccountToAccountInfo:()=>qa,convertAptosAccountToSigner:()=>Qa,createIndexerClient:()=>U,fetchAccountCoins:()=>J,fetchAccountCollections:()=>ot,fetchAccountTokens:()=>ut,fetchAccountTransactions:()=>pt,fetchAddressFromName:()=>Z,fetchAptBalance:()=>W,fetchBalance:()=>K,fetchEstimatedGasPrice:()=>tt,fetchEvents:()=>yt,fetchFungibleAssetMetadata:()=>it,fetchLedgerInfo:()=>nt,fetchNameFromAddress:()=>Y,fetchProcessorStatus:()=>X,fetchResourceType:()=>at,fetchResources:()=>rt,fetchTokenData:()=>_t,fetchTransaction:()=>et,fetchUserTransactions:()=>ct,fetchViewModule:()=>st,formatApt:()=>Na,formatUnits:()=>ea,getClients:()=>H,getExplorerUrl:()=>Ra,parseApt:()=>Da,parseUnits:()=>ta,signAndSubmitTransaction:()=>Mt,signTransaction:()=>gt,simulateTransaction:()=>mt,submitTransaction:()=>dt,waitForTransaction:()=>bt});module.exports=sa(La);var Xe=require("zustand/middleware"),Ze=require("zustand/vanilla"),h=require("@aptos-labs/ts-sdk");var Pe=require("graphql-request");var b=require("graphql-tag"),At=b.gql`
|
|
2
2
|
fragment CollectionDataFields on current_collections_v2 {
|
|
3
3
|
uri
|
|
4
4
|
max_supply
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
token_name
|
|
29
29
|
token_uri
|
|
30
30
|
}
|
|
31
|
-
${
|
|
31
|
+
${At}`,ia=b.gql`
|
|
32
32
|
fragment TokenOwnershipFields on current_token_ownerships_v2 {
|
|
33
33
|
current_token_data {
|
|
34
34
|
...TokenDataFields
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
owner_address
|
|
38
38
|
amount
|
|
39
39
|
}
|
|
40
|
-
${G}`,
|
|
40
|
+
${G}`,pa=b.gql`
|
|
41
41
|
fragment CollectionOwnership on current_collection_ownership_v2_view {
|
|
42
42
|
distinct_tokens
|
|
43
43
|
single_token_uri
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
...CollectionDataFields
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
${
|
|
48
|
+
${At}`,ua=b.gql`
|
|
49
49
|
fragment PrimaryAptosName on current_aptos_names {
|
|
50
50
|
domain
|
|
51
51
|
subdomain
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,xt=b.gql`
|
|
54
54
|
fragment FungibleAssetMetadataFields on fungible_asset_metadata {
|
|
55
55
|
asset_type
|
|
56
56
|
creator_address
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
supply_v2
|
|
64
64
|
maximum_v2
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
66
|
+
`,ya=b.gql`
|
|
67
67
|
fragment FungibleAssetActivity on fungible_asset_activities {
|
|
68
68
|
owner_primary_aptos_name: owner_aptos_names(
|
|
69
69
|
where: {is_primary: {_eq: true}, is_active: {_eq: true}}
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
transaction_timestamp
|
|
87
87
|
transaction_version
|
|
88
88
|
}
|
|
89
|
-
${
|
|
90
|
-
${
|
|
89
|
+
${ua}
|
|
90
|
+
${xt}`,ca=b.gql`
|
|
91
91
|
fragment BaseTokenActivity on token_activities_v2 {
|
|
92
92
|
from_address
|
|
93
93
|
to_address
|
|
@@ -97,7 +97,7 @@ ${vt}`,ia=b.gql`
|
|
|
97
97
|
event_account_address
|
|
98
98
|
event_index
|
|
99
99
|
}
|
|
100
|
-
`,
|
|
100
|
+
`,Bt=b.gql`
|
|
101
101
|
fragment TokenActivity on token_activities_v2 {
|
|
102
102
|
...BaseTokenActivity
|
|
103
103
|
primary_aptos_name_from: aptos_names_from(
|
|
@@ -120,8 +120,8 @@ ${vt}`,ia=b.gql`
|
|
|
120
120
|
token_amount
|
|
121
121
|
token_data_id
|
|
122
122
|
}
|
|
123
|
-
${
|
|
124
|
-
${G}`,
|
|
123
|
+
${ca}
|
|
124
|
+
${G}`,la=b.gql`
|
|
125
125
|
fragment DelegatedStakingActivity on delegated_staking_activities {
|
|
126
126
|
amount
|
|
127
127
|
delegator_address
|
|
@@ -130,7 +130,19 @@ ${G}`,pa=b.gql`
|
|
|
130
130
|
pool_address
|
|
131
131
|
transaction_version
|
|
132
132
|
}
|
|
133
|
-
`,
|
|
133
|
+
`,kt=b.gql`
|
|
134
|
+
fragment UserTransaction on user_transactions {
|
|
135
|
+
sequence_number
|
|
136
|
+
sender
|
|
137
|
+
entry_function_id_str
|
|
138
|
+
expiration_timestamp_secs
|
|
139
|
+
gas_unit_price
|
|
140
|
+
max_gas_amount
|
|
141
|
+
parent_signature_type
|
|
142
|
+
version
|
|
143
|
+
timestamp
|
|
144
|
+
}
|
|
145
|
+
`,da=b.gql`
|
|
134
146
|
fragment AccountTransaction on account_transactions {
|
|
135
147
|
account_address
|
|
136
148
|
transaction_version
|
|
@@ -150,13 +162,13 @@ ${G}`,pa=b.gql`
|
|
|
150
162
|
...DelegatedStakingActivity
|
|
151
163
|
}
|
|
152
164
|
user_transaction {
|
|
153
|
-
|
|
154
|
-
sender
|
|
165
|
+
...UserTransaction
|
|
155
166
|
}
|
|
156
167
|
}
|
|
157
|
-
${
|
|
158
|
-
${
|
|
159
|
-
${
|
|
168
|
+
${ya}
|
|
169
|
+
${Bt}
|
|
170
|
+
${la}
|
|
171
|
+
${kt}`,ba=b.gql`
|
|
160
172
|
fragment FungibleAssetBalanceFields on current_fungible_asset_balances {
|
|
161
173
|
amount
|
|
162
174
|
amount_v1
|
|
@@ -174,7 +186,7 @@ ${pa}`,ya=b.gql`
|
|
|
174
186
|
...FungibleAssetMetadataFields
|
|
175
187
|
}
|
|
176
188
|
}
|
|
177
|
-
${
|
|
189
|
+
${xt}`,ma=b.gql`
|
|
178
190
|
query getAccountTokensTotal($address: String!, $where: [current_token_ownerships_v2_bool_exp!]!) {
|
|
179
191
|
current_token_ownerships_v2_aggregate(
|
|
180
192
|
where: {owner_address: {_eq: $address}, amount: {_gt: 0}, _and: $where}
|
|
@@ -184,7 +196,7 @@ ${pa}`,ya=b.gql`
|
|
|
184
196
|
}
|
|
185
197
|
}
|
|
186
198
|
}
|
|
187
|
-
`,
|
|
199
|
+
`,ga=b.gql`
|
|
188
200
|
query getAccountTokenOwnerships($address: String!, $offset: Int, $limit: Int, $where: [current_token_ownerships_v2_bool_exp!]!, $order_by: [current_token_ownerships_v2_order_by!]!) {
|
|
189
201
|
current_token_ownerships_v2(
|
|
190
202
|
where: {owner_address: {_eq: $address}, amount: {_gt: 0}, current_token_data: {token_data_id: {_is_null: false}}, _and: $where}
|
|
@@ -195,7 +207,7 @@ ${pa}`,ya=b.gql`
|
|
|
195
207
|
...TokenOwnershipFields
|
|
196
208
|
}
|
|
197
209
|
}
|
|
198
|
-
${
|
|
210
|
+
${ia}`,Ma=b.gql`
|
|
199
211
|
query getCurrentTokenData($tokenId: String!, $address: String!) {
|
|
200
212
|
current_token_datas_v2(where: {token_data_id: {_eq: $tokenId}}) {
|
|
201
213
|
token_name
|
|
@@ -236,7 +248,7 @@ ${pa}`,ya=b.gql`
|
|
|
236
248
|
event_index
|
|
237
249
|
}
|
|
238
250
|
}
|
|
239
|
-
`,
|
|
251
|
+
`,Ia=b.gql`
|
|
240
252
|
query getAccountCollections($address: String!, $offset: Int, $limit: Int, $where: [current_collection_ownership_v2_view_bool_exp!]!, $order_by: [current_collection_ownership_v2_view_order_by!]!) {
|
|
241
253
|
current_collection_ownership_v2_view(
|
|
242
254
|
where: {owner_address: {_eq: $address}, _and: $where}
|
|
@@ -247,7 +259,7 @@ ${pa}`,ya=b.gql`
|
|
|
247
259
|
...CollectionOwnership
|
|
248
260
|
}
|
|
249
261
|
}
|
|
250
|
-
${
|
|
262
|
+
${pa}`,Sa=b.gql`
|
|
251
263
|
query getTokenData($address: String!) {
|
|
252
264
|
current_token_datas_v2(where: {token_data_id: {_eq: $address}}) {
|
|
253
265
|
...TokenDataFields
|
|
@@ -279,7 +291,7 @@ ${pa}`,ya=b.gql`
|
|
|
279
291
|
event_account_address
|
|
280
292
|
}
|
|
281
293
|
}
|
|
282
|
-
${G}`,
|
|
294
|
+
${G}`,va=b.gql`
|
|
283
295
|
query getActivitiesAggregate($account_address: String!) {
|
|
284
296
|
address_events_summary(where: {account_address: {_eq: $account_address}}) {
|
|
285
297
|
block_metadata {
|
|
@@ -288,7 +300,7 @@ ${pa}`,ya=b.gql`
|
|
|
288
300
|
num_distinct_versions
|
|
289
301
|
}
|
|
290
302
|
}
|
|
291
|
-
`,
|
|
303
|
+
`,Aa=b.gql`
|
|
292
304
|
query getTokenActivities($tokenId: String!, $offset: Int, $limit: Int) {
|
|
293
305
|
token_activities_v2(
|
|
294
306
|
where: {token_data_id: {_eq: $tokenId}}
|
|
@@ -299,7 +311,7 @@ ${pa}`,ya=b.gql`
|
|
|
299
311
|
...TokenActivity
|
|
300
312
|
}
|
|
301
313
|
}
|
|
302
|
-
${
|
|
314
|
+
${Bt}`,xa=b.gql`
|
|
303
315
|
query getTokenAcquisitionActivity($address: String!, $tokenId: String!) {
|
|
304
316
|
token_activities_v2(
|
|
305
317
|
where: {token_data_id: {_eq: $tokenId}, to_address: {_eq: $address}}
|
|
@@ -308,7 +320,7 @@ ${pa}`,ya=b.gql`
|
|
|
308
320
|
transaction_timestamp
|
|
309
321
|
}
|
|
310
322
|
}
|
|
311
|
-
`,
|
|
323
|
+
`,Ba=b.gql`
|
|
312
324
|
query getAccountTransactions($address: String!, $limit: Int, $offset: Int, $where: [account_transactions_bool_exp!]!, $fungible_asset_activities_where: [fungible_asset_activities_bool_exp!]!, $token_activities_v2_where: [token_activities_v2_bool_exp!]!, $order_by: [account_transactions_order_by!]!, $fungible_asset_activities_order_by: [fungible_asset_activities_order_by!]!, $token_activities_v2_order_by: [token_activities_v2_order_by!]!) {
|
|
313
325
|
account_transactions(
|
|
314
326
|
limit: $limit
|
|
@@ -319,7 +331,18 @@ ${pa}`,ya=b.gql`
|
|
|
319
331
|
...AccountTransaction
|
|
320
332
|
}
|
|
321
333
|
}
|
|
322
|
-
${
|
|
334
|
+
${da}`,ka=b.gql`
|
|
335
|
+
query getUserTransactions($limit: Int, $offset: Int, $where: user_transactions_bool_exp, $order_by: [user_transactions_order_by!]!) {
|
|
336
|
+
user_transactions(
|
|
337
|
+
limit: $limit
|
|
338
|
+
offset: $offset
|
|
339
|
+
where: $where
|
|
340
|
+
order_by: $order_by
|
|
341
|
+
) {
|
|
342
|
+
...UserTransaction
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
${kt}`,Ca=b.gql`
|
|
323
346
|
query getFungibleAssetMetadata($type: String!) {
|
|
324
347
|
fungible_asset_metadata(where: {asset_type: {_eq: $type}}) {
|
|
325
348
|
asset_type
|
|
@@ -328,7 +351,7 @@ ${pa}`,ya=b.gql`
|
|
|
328
351
|
symbol
|
|
329
352
|
}
|
|
330
353
|
}
|
|
331
|
-
`,
|
|
354
|
+
`,Oa=b.gql`
|
|
332
355
|
query getFungibleAssetBalances($where: current_fungible_asset_balances_bool_exp, $order_by: [current_fungible_asset_balances_order_by!], $offset: Int, $limit: Int) {
|
|
333
356
|
current_fungible_asset_balances(
|
|
334
357
|
where: $where
|
|
@@ -339,7 +362,7 @@ ${pa}`,ya=b.gql`
|
|
|
339
362
|
...FungibleAssetBalanceFields
|
|
340
363
|
}
|
|
341
364
|
}
|
|
342
|
-
${
|
|
365
|
+
${ba}`,ha=b.gql`
|
|
343
366
|
query getDelegatedStakingRoyalties($address: String!, $pool: String) {
|
|
344
367
|
delegated_staking_activities(
|
|
345
368
|
where: {delegator_address: {_eq: $address}, pool_address: {_eq: $pool}}
|
|
@@ -353,7 +376,7 @@ ${pa}`,ya=b.gql`
|
|
|
353
376
|
transaction_version
|
|
354
377
|
}
|
|
355
378
|
}
|
|
356
|
-
`,
|
|
379
|
+
`,fa=b.gql`
|
|
357
380
|
query getDelegatedStaking($address: String!) {
|
|
358
381
|
delegator_distinct_pool(where: {delegator_address: {_eq: $address}}) {
|
|
359
382
|
delegator_address
|
|
@@ -369,7 +392,7 @@ ${pa}`,ya=b.gql`
|
|
|
369
392
|
}
|
|
370
393
|
}
|
|
371
394
|
}
|
|
372
|
-
`,
|
|
395
|
+
`,Ta=b.gql`
|
|
373
396
|
query getDelegationPools {
|
|
374
397
|
delegated_staking_pools {
|
|
375
398
|
staking_pool_address
|
|
@@ -378,7 +401,7 @@ ${pa}`,ya=b.gql`
|
|
|
378
401
|
}
|
|
379
402
|
}
|
|
380
403
|
}
|
|
381
|
-
`,
|
|
404
|
+
`,Ea=b.gql`
|
|
382
405
|
query getNumberOfDelegators($poolAddress: String) {
|
|
383
406
|
num_active_delegator_per_pool(
|
|
384
407
|
where: {pool_address: {_eq: $poolAddress}, num_active_delegator: {_gt: "0"}}
|
|
@@ -387,5 +410,5 @@ ${pa}`,ya=b.gql`
|
|
|
387
410
|
num_active_delegator
|
|
388
411
|
}
|
|
389
412
|
}
|
|
390
|
-
`,Oa=(t,a,e,r)=>t();function xt(t,a=Oa){return{getAccountTokensTotal(e,r){return a(n=>t.request(ca,e,{...r,...n}),"getAccountTokensTotal","query",e)},getAccountTokenOwnerships(e,r){return a(n=>t.request(la,e,{...r,...n}),"getAccountTokenOwnerships","query",e)},getCurrentTokenData(e,r){return a(n=>t.request(da,e,{...r,...n}),"getCurrentTokenData","query",e)},getAccountCollections(e,r){return a(n=>t.request(ba,e,{...r,...n}),"getAccountCollections","query",e)},getTokenData(e,r){return a(n=>t.request(ma,e,{...r,...n}),"getTokenData","query",e)},getActivitiesAggregate(e,r){return a(n=>t.request(ga,e,{...r,...n}),"getActivitiesAggregate","query",e)},getTokenActivities(e,r){return a(n=>t.request(Ma,e,{...r,...n}),"getTokenActivities","query",e)},getTokenAcquisitionActivity(e,r){return a(n=>t.request(Ia,e,{...r,...n}),"getTokenAcquisitionActivity","query",e)},getAccountTransactions(e,r){return a(n=>t.request(Sa,e,{...r,...n}),"getAccountTransactions","query",e)},getFungibleAssetMetadata(e,r){return a(n=>t.request(va,e,{...r,...n}),"getFungibleAssetMetadata","query",e)},getFungibleAssetBalances(e,r){return a(n=>t.request(Aa,e,{...r,...n}),"getFungibleAssetBalances","query",e)},getDelegatedStakingRoyalties(e,r){return a(n=>t.request(xa,e,{...r,...n}),"getDelegatedStakingRoyalties","query",e)},getDelegatedStaking(e,r){return a(n=>t.request(Ba,e,{...r,...n}),"getDelegatedStaking","query",e)},getDelegationPools(e,r){return a(n=>t.request(ka,e,{...r,...n}),"getDelegationPools","query",e)},getNumberOfDelegators(e,r){return a(n=>t.request(Ca,e,{...r,...n}),"getNumberOfDelegators","query",e)}}}var Bt=(e=>(e.AccountAddress="account_address",e.TransactionVersion="transaction_version",e))(Bt||{}),kt=(r=>(r.AccountAddress="account_address",r.MinBlockHeight="min_block_height",r.NumDistinctVersions="num_distinct_versions",r))(kt||{}),Ct=(e=>(e.AccountAddress="account_address",e.TransactionVersion="transaction_version",e))(Ct||{}),Ot=(e=>(e.Address="address",e.TransactionVersion="transaction_version",e))(Ot||{}),ht=(p=>(p.BlockHeight="block_height",p.Epoch="epoch",p.FailedProposerIndices="failed_proposer_indices",p.Id="id",p.PreviousBlockVotesBitvec="previous_block_votes_bitvec",p.Proposer="proposer",p.Round="round",p.Timestamp="timestamp",p.Version="version",p))(ht||{}),ft=(s=>(s.ActivityType="activity_type",s.Amount="amount",s.BlockHeight="block_height",s.CoinType="coin_type",s.EntryFunctionIdStr="entry_function_id_str",s.EventAccountAddress="event_account_address",s.EventCreationNumber="event_creation_number",s.EventIndex="event_index",s.EventSequenceNumber="event_sequence_number",s.IsGasFee="is_gas_fee",s.IsTransactionSuccess="is_transaction_success",s.OwnerAddress="owner_address",s.StorageRefundAmount="storage_refund_amount",s.TransactionTimestamp="transaction_timestamp",s.TransactionVersion="transaction_version",s))(ft||{}),Tt=(e=>(e.IsGasFee="is_gas_fee",e.IsTransactionSuccess="is_transaction_success",e))(Tt||{}),Et=(e=>(e.IsGasFee="is_gas_fee",e.IsTransactionSuccess="is_transaction_success",e))(Et||{}),Ft=(o=>(o.Amount="amount",o.CoinType="coin_type",o.CoinTypeHash="coin_type_hash",o.OwnerAddress="owner_address",o.TransactionTimestamp="transaction_timestamp",o.TransactionVersion="transaction_version",o))(Ft||{}),wt=(g=>(g.CoinType="coin_type",g.CoinTypeHash="coin_type_hash",g.CreatorAddress="creator_address",g.Decimals="decimals",g.Name="name",g.SupplyAggregatorTableHandle="supply_aggregator_table_handle",g.SupplyAggregatorTableKey="supply_aggregator_table_key",g.Symbol="symbol",g.TransactionCreatedTimestamp="transaction_created_timestamp",g.TransactionVersionCreated="transaction_version_created",g))(wt||{}),Vt=(o=>(o.CoinType="coin_type",o.CoinTypeHash="coin_type_hash",o.Supply="supply",o.TransactionEpoch="transaction_epoch",o.TransactionTimestamp="transaction_timestamp",o.TransactionVersion="transaction_version",o))(Vt||{}),Pt=(i=>(i.CollectionDataIdHash="collection_data_id_hash",i.CollectionName="collection_name",i.CreatorAddress="creator_address",i.Description="description",i.DescriptionMutable="description_mutable",i.Maximum="maximum",i.MaximumMutable="maximum_mutable",i.MetadataUri="metadata_uri",i.Supply="supply",i.TableHandle="table_handle",i.TransactionTimestamp="transaction_timestamp",i.TransactionVersion="transaction_version",i.UriMutable="uri_mutable",i))(Pt||{}),Dt=(_=>(_.Domain="domain",_.ExpirationTimestamp="expiration_timestamp",_.IsDeleted="is_deleted",_.LastTransactionVersion="last_transaction_version",_.RegisteredAddress="registered_address",_.Subdomain="subdomain",_.TokenName="token_name",_))(Dt||{}),Rt=(c=>(c.Domain="domain",c.ExpirationTimestamp="expiration_timestamp",c.IsDeleted="is_deleted",c.LastTransactionVersion="last_transaction_version",c.RegisteredAddress="registered_address",c.Subdomain="subdomain",c.TokenName="token_name",c.TokenStandard="token_standard",c))(Rt||{}),Nt=(i=>(i.Domain="domain",i.DomainExpirationTimestamp="domain_expiration_timestamp",i.DomainWithSuffix="domain_with_suffix",i.ExpirationTimestamp="expiration_timestamp",i.IsActive="is_active",i.IsPrimary="is_primary",i.LastTransactionVersion="last_transaction_version",i.OwnerAddress="owner_address",i.RegisteredAddress="registered_address",i.Subdomain="subdomain",i.SubdomainExpirationPolicy="subdomain_expiration_policy",i.TokenName="token_name",i.TokenStandard="token_standard",i))(Nt||{}),qt=(e=>(e.IsActive="is_active",e.IsPrimary="is_primary",e))(qt||{}),Qt=(e=>(e.IsActive="is_active",e.IsPrimary="is_primary",e))(Qt||{}),Lt=(o=>(o.Amount="amount",o.CoinType="coin_type",o.CoinTypeHash="coin_type_hash",o.LastTransactionTimestamp="last_transaction_timestamp",o.LastTransactionVersion="last_transaction_version",o.OwnerAddress="owner_address",o))(Lt||{}),$t=(i=>(i.CollectionDataIdHash="collection_data_id_hash",i.CollectionName="collection_name",i.CreatorAddress="creator_address",i.Description="description",i.DescriptionMutable="description_mutable",i.LastTransactionTimestamp="last_transaction_timestamp",i.LastTransactionVersion="last_transaction_version",i.Maximum="maximum",i.MaximumMutable="maximum_mutable",i.MetadataUri="metadata_uri",i.Supply="supply",i.TableHandle="table_handle",i.UriMutable="uri_mutable",i))($t||{}),Gt=(c=>(c.CollectionId="collection_id",c.CollectionName="collection_name",c.CollectionUri="collection_uri",c.CreatorAddress="creator_address",c.DistinctTokens="distinct_tokens",c.LastTransactionVersion="last_transaction_version",c.OwnerAddress="owner_address",c.SingleTokenUri="single_token_uri",c))(Gt||{}),zt=(s=>(s.CollectionId="collection_id",s.CollectionName="collection_name",s.CollectionProperties="collection_properties",s.CreatorAddress="creator_address",s.CurrentSupply="current_supply",s.Description="description",s.LastTransactionTimestamp="last_transaction_timestamp",s.LastTransactionVersion="last_transaction_version",s.MaxSupply="max_supply",s.MutableDescription="mutable_description",s.MutableUri="mutable_uri",s.TableHandleV1="table_handle_v1",s.TokenStandard="token_standard",s.TotalMintedV2="total_minted_v2",s.Uri="uri",s))(zt||{}),jt=(_=>(_.ActiveTableHandle="active_table_handle",_.InactiveTableHandle="inactive_table_handle",_.LastTransactionVersion="last_transaction_version",_.OperatorCommissionPercentage="operator_commission_percentage",_.StakingPoolAddress="staking_pool_address",_.TotalCoins="total_coins",_.TotalShares="total_shares",_))(jt||{}),Ut=(_=>(_.DelegationPoolAddress="delegation_pool_address",_.DelegatorAddress="delegator_address",_.LastTransactionTimestamp="last_transaction_timestamp",_.LastTransactionVersion="last_transaction_version",_.PendingVoter="pending_voter",_.TableHandle="table_handle",_.Voter="voter",_))(Ut||{}),Jt=(_=>(_.DelegatorAddress="delegator_address",_.LastTransactionVersion="last_transaction_version",_.ParentTableHandle="parent_table_handle",_.PoolAddress="pool_address",_.PoolType="pool_type",_.Shares="shares",_.TableHandle="table_handle",_))(Jt||{}),Ht=(S=>(S.Amount="amount",S.AmountV1="amount_v1",S.AmountV2="amount_v2",S.AssetType="asset_type",S.AssetTypeV1="asset_type_v1",S.AssetTypeV2="asset_type_v2",S.IsFrozen="is_frozen",S.IsPrimary="is_primary",S.LastTransactionTimestamp="last_transaction_timestamp",S.LastTransactionTimestampV1="last_transaction_timestamp_v1",S.LastTransactionTimestampV2="last_transaction_timestamp_v2",S.LastTransactionVersion="last_transaction_version",S.LastTransactionVersionV1="last_transaction_version_v1",S.LastTransactionVersionV2="last_transaction_version_v2",S.OwnerAddress="owner_address",S.StorageId="storage_id",S.TokenStandard="token_standard",S))(Ht||{}),Wt=(_=>(_.AllowUngatedTransfer="allow_ungated_transfer",_.IsDeleted="is_deleted",_.LastGuidCreationNum="last_guid_creation_num",_.LastTransactionVersion="last_transaction_version",_.ObjectAddress="object_address",_.OwnerAddress="owner_address",_.StateKeyHash="state_key_hash",_))(Wt||{}),Kt=(n=>(n.LastTransactionVersion="last_transaction_version",n.OperatorAddress="operator_address",n.StakingPoolAddress="staking_pool_address",n.VoterAddress="voter_address",n))(Kt||{}),Xt=(_=>(_.DecodedKey="decoded_key",_.DecodedValue="decoded_value",_.IsDeleted="is_deleted",_.Key="key",_.KeyHash="key_hash",_.LastTransactionVersion="last_transaction_version",_.TableHandle="table_handle",_))(Xt||{}),Zt=(y=>(y.CollectionDataIdHash="collection_data_id_hash",y.CollectionName="collection_name",y.CreatorAddress="creator_address",y.DefaultProperties="default_properties",y.Description="description",y.DescriptionMutable="description_mutable",y.LargestPropertyVersion="largest_property_version",y.LastTransactionTimestamp="last_transaction_timestamp",y.LastTransactionVersion="last_transaction_version",y.Maximum="maximum",y.MaximumMutable="maximum_mutable",y.MetadataUri="metadata_uri",y.Name="name",y.PayeeAddress="payee_address",y.PropertiesMutable="properties_mutable",y.RoyaltyMutable="royalty_mutable",y.RoyaltyPointsDenominator="royalty_points_denominator",y.RoyaltyPointsNumerator="royalty_points_numerator",y.Supply="supply",y.TokenDataIdHash="token_data_id_hash",y.UriMutable="uri_mutable",y))(Zt||{}),Yt=(s=>(s.CollectionId="collection_id",s.Decimals="decimals",s.Description="description",s.IsDeletedV2="is_deleted_v2",s.IsFungibleV2="is_fungible_v2",s.LargestPropertyVersionV1="largest_property_version_v1",s.LastTransactionTimestamp="last_transaction_timestamp",s.LastTransactionVersion="last_transaction_version",s.Maximum="maximum",s.Supply="supply",s.TokenDataId="token_data_id",s.TokenName="token_name",s.TokenProperties="token_properties",s.TokenStandard="token_standard",s.TokenUri="token_uri",s))(Yt||{}),te=(l=>(l.Amount="amount",l.CollectionDataIdHash="collection_data_id_hash",l.CollectionName="collection_name",l.CreatorAddress="creator_address",l.LastTransactionTimestamp="last_transaction_timestamp",l.LastTransactionVersion="last_transaction_version",l.Name="name",l.OwnerAddress="owner_address",l.PropertyVersion="property_version",l.TableType="table_type",l.TokenDataIdHash="token_data_id_hash",l.TokenProperties="token_properties",l))(te||{}),ee=(i=>(i.Amount="amount",i.IsFungibleV2="is_fungible_v2",i.IsSoulboundV2="is_soulbound_v2",i.LastTransactionTimestamp="last_transaction_timestamp",i.LastTransactionVersion="last_transaction_version",i.NonTransferrableByOwner="non_transferrable_by_owner",i.OwnerAddress="owner_address",i.PropertyVersionV1="property_version_v1",i.StorageId="storage_id",i.TableTypeV1="table_type_v1",i.TokenDataId="token_data_id",i.TokenPropertiesMutatedV1="token_properties_mutated_v1",i.TokenStandard="token_standard",i))(ee||{}),ae=(r=>(r.IsFungibleV2="is_fungible_v2",r.IsSoulboundV2="is_soulbound_v2",r.NonTransferrableByOwner="non_transferrable_by_owner",r))(ae||{}),re=(r=>(r.IsFungibleV2="is_fungible_v2",r.IsSoulboundV2="is_soulbound_v2",r.NonTransferrableByOwner="non_transferrable_by_owner",r))(re||{}),ne=(u=>(u.Amount="amount",u.CollectionDataIdHash="collection_data_id_hash",u.CollectionId="collection_id",u.CollectionName="collection_name",u.CreatorAddress="creator_address",u.FromAddress="from_address",u.LastTransactionTimestamp="last_transaction_timestamp",u.LastTransactionVersion="last_transaction_version",u.Name="name",u.PropertyVersion="property_version",u.TableHandle="table_handle",u.ToAddress="to_address",u.TokenDataId="token_data_id",u.TokenDataIdHash="token_data_id_hash",u))(ne||{}),_e=(o=>(o.LastTransactionTimestamp="last_transaction_timestamp",o.LastTransactionVersion="last_transaction_version",o.PayeeAddress="payee_address",o.RoyaltyPointsDenominator="royalty_points_denominator",o.RoyaltyPointsNumerator="royalty_points_numerator",o.TokenDataId="token_data_id",o))(_e||{}),oe=(e=>(e.Asc="ASC",e.Desc="DESC",e))(oe||{}),se=(o=>(o.Amount="amount",o.DelegatorAddress="delegator_address",o.EventIndex="event_index",o.EventType="event_type",o.PoolAddress="pool_address",o.TransactionVersion="transaction_version",o))(se||{}),ie=(_=>(_.ActiveTableHandle="active_table_handle",_.InactiveTableHandle="inactive_table_handle",_.OperatorCommissionPercentage="operator_commission_percentage",_.StakingPoolAddress="staking_pool_address",_.TotalCoins="total_coins",_.TotalShares="total_shares",_.TransactionVersion="transaction_version",_))(ie||{}),pe=(e=>(e.FirstTransactionVersion="first_transaction_version",e.StakingPoolAddress="staking_pool_address",e))(pe||{}),ue=(e=>(e.DelegatorAddress="delegator_address",e.PoolAddress="pool_address",e))(ue||{}),ye=(p=>(p.AccountAddress="account_address",p.CreationNumber="creation_number",p.Data="data",p.EventIndex="event_index",p.IndexedType="indexed_type",p.SequenceNumber="sequence_number",p.TransactionBlockHeight="transaction_block_height",p.TransactionVersion="transaction_version",p.Type="type",p))(ye||{}),ce=(v=>(v.Amount="amount",v.AssetType="asset_type",v.BlockHeight="block_height",v.EntryFunctionIdStr="entry_function_id_str",v.EventIndex="event_index",v.GasFeePayerAddress="gas_fee_payer_address",v.IsFrozen="is_frozen",v.IsGasFee="is_gas_fee",v.IsTransactionSuccess="is_transaction_success",v.OwnerAddress="owner_address",v.StorageId="storage_id",v.StorageRefundAmount="storage_refund_amount",v.TokenStandard="token_standard",v.TransactionTimestamp="transaction_timestamp",v.TransactionVersion="transaction_version",v.Type="type",v))(ce||{}),le=(u=>(u.AssetType="asset_type",u.CreatorAddress="creator_address",u.Decimals="decimals",u.IconUri="icon_uri",u.LastTransactionTimestamp="last_transaction_timestamp",u.LastTransactionVersion="last_transaction_version",u.MaximumV2="maximum_v2",u.Name="name",u.ProjectUri="project_uri",u.SupplyAggregatorTableHandleV1="supply_aggregator_table_handle_v1",u.SupplyAggregatorTableKeyV1="supply_aggregator_table_key_v1",u.SupplyV2="supply_v2",u.Symbol="symbol",u.TokenStandard="token_standard",u))(le||{}),de=(e=>(e.Db="db",e.IsIndexerUp="is_indexer_up",e))(de||{}),be=(a=>(a.ChainId="chain_id",a))(be||{}),me=(e=>(e.Address="address",e.TransactionVersion="transaction_version",e))(me||{}),ge=(p=>(p.AnimationOptimizerRetryCount="animation_optimizer_retry_count",p.AssetUri="asset_uri",p.CdnAnimationUri="cdn_animation_uri",p.CdnImageUri="cdn_image_uri",p.CdnJsonUri="cdn_json_uri",p.ImageOptimizerRetryCount="image_optimizer_retry_count",p.JsonParserRetryCount="json_parser_retry_count",p.RawAnimationUri="raw_animation_uri",p.RawImageUri="raw_image_uri",p))(ge||{}),Me=(e=>(e.NumActiveDelegator="num_active_delegator",e.PoolAddress="pool_address",e))(Me||{}),N=(o=>(o.Asc="asc",o.AscNullsFirst="asc_nulls_first",o.AscNullsLast="asc_nulls_last",o.Desc="desc",o.DescNullsFirst="desc_nulls_first",o.DescNullsLast="desc_nulls_last",o))(N||{}),Ie=(n=>(n.LastSuccessVersion="last_success_version",n.LastTransactionTimestamp="last_transaction_timestamp",n.LastUpdated="last_updated",n.Processor="processor",n))(Ie||{}),Se=(_=>(_.NumVotes="num_votes",_.ProposalId="proposal_id",_.ShouldPass="should_pass",_.StakingPoolAddress="staking_pool_address",_.TransactionTimestamp="transaction_timestamp",_.TransactionVersion="transaction_version",_.VoterAddress="voter_address",_))(Se||{}),ve=(m=>(m.IsSenderPrimary="is_sender_primary",m.MultiAgentIndex="multi_agent_index",m.MultiSigIndex="multi_sig_index",m.PublicKey="public_key",m.PublicKeyIndices="public_key_indices",m.Signature="signature",m.Signer="signer",m.Threshold="threshold",m.TransactionBlockHeight="transaction_block_height",m.TransactionVersion="transaction_version",m.Type="type",m))(ve||{}),Ae=(o=>(o.DecodedKey="decoded_key",o.DecodedValue="decoded_value",o.Key="key",o.TableHandle="table_handle",o.TransactionVersion="transaction_version",o.WriteSetChangeIndex="write_set_change_index",o))(Ae||{}),xe=(r=>(r.Handle="handle",r.KeyType="key_type",r.ValueType="value_type",r))(xe||{}),Be=(I=>(I.CoinAmount="coin_amount",I.CoinType="coin_type",I.CollectionDataIdHash="collection_data_id_hash",I.CollectionName="collection_name",I.CreatorAddress="creator_address",I.EventAccountAddress="event_account_address",I.EventCreationNumber="event_creation_number",I.EventIndex="event_index",I.EventSequenceNumber="event_sequence_number",I.FromAddress="from_address",I.Name="name",I.PropertyVersion="property_version",I.ToAddress="to_address",I.TokenAmount="token_amount",I.TokenDataIdHash="token_data_id_hash",I.TransactionTimestamp="transaction_timestamp",I.TransactionVersion="transaction_version",I.TransferType="transfer_type",I))(Be||{}),ke=(s=>(s.AfterValue="after_value",s.BeforeValue="before_value",s.EntryFunctionIdStr="entry_function_id_str",s.EventAccountAddress="event_account_address",s.EventIndex="event_index",s.FromAddress="from_address",s.IsFungibleV2="is_fungible_v2",s.PropertyVersionV1="property_version_v1",s.ToAddress="to_address",s.TokenAmount="token_amount",s.TokenDataId="token_data_id",s.TokenStandard="token_standard",s.TransactionTimestamp="transaction_timestamp",s.TransactionVersion="transaction_version",s.Type="type",s))(ke||{}),Ce=(a=>(a.IsFungibleV2="is_fungible_v2",a))(Ce||{}),Oe=(a=>(a.IsFungibleV2="is_fungible_v2",a))(Oe||{}),he=(y=>(y.CollectionDataIdHash="collection_data_id_hash",y.CollectionName="collection_name",y.CreatorAddress="creator_address",y.DefaultProperties="default_properties",y.Description="description",y.DescriptionMutable="description_mutable",y.LargestPropertyVersion="largest_property_version",y.Maximum="maximum",y.MaximumMutable="maximum_mutable",y.MetadataUri="metadata_uri",y.Name="name",y.PayeeAddress="payee_address",y.PropertiesMutable="properties_mutable",y.RoyaltyMutable="royalty_mutable",y.RoyaltyPointsDenominator="royalty_points_denominator",y.RoyaltyPointsNumerator="royalty_points_numerator",y.Supply="supply",y.TokenDataIdHash="token_data_id_hash",y.TransactionTimestamp="transaction_timestamp",y.TransactionVersion="transaction_version",y.UriMutable="uri_mutable",y))(he||{}),fe=(l=>(l.Amount="amount",l.CollectionDataIdHash="collection_data_id_hash",l.CollectionName="collection_name",l.CreatorAddress="creator_address",l.Name="name",l.OwnerAddress="owner_address",l.PropertyVersion="property_version",l.TableHandle="table_handle",l.TableType="table_type",l.TokenDataIdHash="token_data_id_hash",l.TransactionTimestamp="transaction_timestamp",l.TransactionVersion="transaction_version",l))(fe||{}),Te=(p=>(p.CollectionDataIdHash="collection_data_id_hash",p.CollectionName="collection_name",p.CreatorAddress="creator_address",p.Name="name",p.PropertyVersion="property_version",p.TokenDataIdHash="token_data_id_hash",p.TokenProperties="token_properties",p.TransactionTimestamp="transaction_timestamp",p.TransactionVersion="transaction_version",p))(Te||{}),Ee=(u=>(u.BlockHeight="block_height",u.EntryFunctionContractAddress="entry_function_contract_address",u.EntryFunctionFunctionName="entry_function_function_name",u.EntryFunctionIdStr="entry_function_id_str",u.EntryFunctionModuleName="entry_function_module_name",u.Epoch="epoch",u.ExpirationTimestampSecs="expiration_timestamp_secs",u.GasUnitPrice="gas_unit_price",u.MaxGasAmount="max_gas_amount",u.ParentSignatureType="parent_signature_type",u.Sender="sender",u.SequenceNumber="sequence_number",u.Timestamp="timestamp",u.Version="version",u))(Ee||{});function z(t,a){let e=new Fe.GraphQLClient(t,a);return xt(e)}var Re=require("@aptos-labs/ts-sdk");var k=async({limit:t,offset:a,queryFn:e})=>{let r=await e({limit:t,offset:a}),{hasNextPage:n,hasPrevPage:d,...o}=r,_=n?a+t:void 0,c=d??a>0?Math.max(a-t,0):void 0;return{nextCursor:_,prevCursor:c,...o}};var C=class extends Error{constructor(e,r){super();this.docsBaseUrl="https://js-pro-docs.vercel.app/";this.name="AptosJSProError";this.shortMessage=e,this.longMessage=r?.longMessage}};var x=class extends C{constructor(){super("The AptosJSProClient was not initialized with an indexer",{longMessage:"The AptosJSProClient was not initialized with an indexer. Please specify an indexer endpoint when setting up custom networks."});this.name="IndexerNotInitializedError"}},f=class extends C{constructor(){super("The AptosJSProClient was not initialized with a signer",{longMessage:"The AptosJSProClient was not initialized with a signer. Please specify a signer when setting up the client."});this.name="SignerNotFoundError"}};var O,E,T=class{constructor(a,e){h(this,O);h(this,E);if(!a)return;let n=[e,a].filter(Boolean).join(".").toLowerCase().replace(/(\.apt)$/,""),d=/^(?:([a-zA-Z0-9-]+)\.)?([a-zA-Z0-9-]+)$/,o=n.match(d);if(!o)return;let[,_,c]=o;B(this,O,c),B(this,E,_)}toString(){return M(this,O)?this.noSuffix().concat(".apt"):""}noSuffix(){return M(this,O)?M(this,E)?`${M(this,E)}.${M(this,O)}`:M(this,O):""}};O=new WeakMap,E=new WeakMap;var we="https://www.aptosnames.com/api";function Ve(t){let a=t.match(/^https:\/\/aptosnames.com\/name\/([^/]+)$/)??t.match(/^https:\/\/aptosnames.com\/api(?:\/[^/]+)?\/v\d+\/metadata\/([^/]+)/);return a?`${we}/v1/metadata/${a[1]}`:t}var j=t=>t.domain?new T(t.domain,t.subdomain):void 0,q=t=>({assetType:t.asset_type,creatorAddress:t.creator_address,decimals:t.decimals,iconUri:t.icon_uri,name:t.name,projectUri:t.project_uri,symbol:t.symbol,tokenStandard:t.token_standard}),Pe=t=>t.map(a=>({amount:a.amount,amountV1:a.amount_v1,amountV2:a.amount_v2,assetType:a.asset_type,assetTypeV1:a.asset_type_v1,assetTypeV2:a.asset_type_v2,isFrozen:a.is_frozen,isPrimary:a.is_primary,lastTransactionTimestamp:a.last_transaction_timestamp,lastTransactionVersion:a.last_transaction_version,metadata:q(a.metadata),ownerAddress:a.owner_address,tokenStandard:a.token_standard})),U=t=>({cdnImageUri:t.cdn_asset_uris?.cdn_image_uri,collectionId:t.collection_id,collectionName:t.collection_name,creatorAddress:t.creator_address,description:t.description,metadataUri:t.uri,name:t.collection_name,supply:t.max_supply});var D=t=>{let a=Ve(t.token_uri);return{cdnImageUri:t.cdn_asset_uris?.cdn_image_uri,collection:t.current_collection?.collection_name??"",collectionData:t.current_collection?U(t.current_collection):void 0,collectionId:t.current_collection?.collection_id??"",creator:t.current_collection?.creator_address??"",description:t.description,isFungibleV2:t.is_fungible_v2??!1,isSoulbound:!1,lastTransactionTimestamp:t.last_transaction_timestamp,lastTransactionVersion:t.last_transaction_version,metadataUri:a,name:t.token_name,tokenId:t.token_data_id,tokenProperties:t.token_properties,tokenStandard:t.token_standard}},Q=t=>({fromAddress:t.from_address,toAddress:t.to_address,transactionTimestamp:t.transaction_timestamp,transactionVersion:t.transaction_version,type:t.type,eventAccountAddress:t.event_account_address,eventIndex:t.event_index}),De=t=>{let a=[],e=[],r=[];return t.fungible_asset_activities.forEach(n=>{!n.asset_type||!n.metadata||a.push(ha({...n,asset_type:n.asset_type,metadata:n.metadata}))}),t.token_activities_v2.forEach(n=>{n.current_token_data&&e.push(fa({...n,current_token_data:n.current_token_data}))}),t.delegated_staking_activities.forEach(n=>r.push(Ta(n))),{accountAddress:t.account_address,transactionVersion:t.transaction_version,fungibleAssetActivities:a,tokenActivities:e,delegatedStakingActivities:r,userTransaction:t.user_transaction?{sequenceNumber:t.user_transaction.sequence_number,sender:t.user_transaction.sender}:void 0}},ha=t=>({ownerAddress:t.owner_address,ownerPrimaryAptosName:t.owner_primary_aptos_name.at(0)?j(t.owner_primary_aptos_name[0]):void 0,amount:t.amount,type:t.type,blockHeight:t.block_height,assetType:t.asset_type,metadata:q(t.metadata),entryFunctionIdStr:t.entry_function_id_str,eventIndex:t.event_index,isGasFee:t.is_gas_fee,gasFeePayerAddress:t.gas_fee_payer_address,isTransactionSuccess:t.is_transaction_success,transactionTimestamp:t.transaction_timestamp,transactionVersion:t.transaction_version}),fa=t=>({...Q(t),primaryAptosNameFrom:t.primary_aptos_name_from.at(0)?j(t.primary_aptos_name_from[0]):void 0,primaryAptosNameTo:t.primary_aptos_name_to.at(0)?j(t.primary_aptos_name_to[0]):void 0,currentTokenData:D(t.current_token_data),propertyVersionV1:t.property_version_v1,tokenAmount:t.token_amount,tokenDataId:t.token_data_id}),Ta=t=>({delegatorAddress:t.delegator_address,eventIndex:t.event_index,eventType:t.event_type,poolAddress:t.pool_address,transactionVersion:t.transaction_version,amount:t.amount});async function J({address:t,network:a,limit:e=100,offset:r=0,orderBy:n,where:d}){let{indexer:o}=this.getClients({network:a});if(!o)throw new x;return k({limit:e,offset:r,queryFn:async({limit:_,offset:c})=>{let p=await o.getFungibleAssetBalances({limit:_,offset:c,order_by:n,where:{_and:[{metadata:{asset_type:{_is_null:!1}},owner_address:{_eq:Re.AccountAddress.from(t).toString()}},d??{}]}}),g=p.current_fungible_asset_balances.filter(m=>m.metadata!==void 0&&m.metadata!==null);return{balances:Pe(g),hasNextPage:p.current_fungible_asset_balances.length===_}}})}function H({network:t}={}){let a=this.aptos,e=this.indexer;return t&&(a=this.createAptos(void 0,t),e=this.createIndexer(void 0,t)),{account:this.account,aptos:a,indexer:e,network:t??this.network,signer:this.signer}}var Ne=require("@aptos-labs/ts-sdk");async function W({address:t,network:a}){let{aptos:e}=this.getClients({network:a}),r=await e.account.getAccountCoinAmount({accountAddress:Ne.AccountAddress.from(t).toString(),coinType:"0x1::aptos_coin::AptosCoin"});return BigInt(r)}var qe=require("@aptos-labs/ts-sdk");async function K({address:t,asset:a,network:e}){let{aptos:r}=this.getClients({network:e}),n=a.includes("::"),d=await r.account.getAccountCoinAmount({accountAddress:qe.AccountAddress.from(t).toString(),coinType:n?a:void 0,faMetadataAddress:n?void 0:a});return BigInt(d)}async function X({network:t,processor:a}){let{aptos:e}=this.getClients({network:t}),r=await e.getProcessorStatus(a);return{lastSuccessVersion:r.last_success_version,lastUpdated:r.last_updated}}var Qe=require("@aptos-labs/ts-sdk");var F=async(t,a)=>{try{return await t()}catch{return a}};async function Z({network:t,name:a}){let{aptos:e}=this.getClients({network:t}),r=await F(()=>e.getTargetAddress({name:a.toString()}),void 0);return r?Qe.AccountAddress.from(r):void 0}var Le=require("@aptos-labs/ts-sdk");async function Y({network:t,address:a}){let{aptos:e}=this.getClients({network:t}),r=await F(()=>e.getPrimaryName({address:Le.AccountAddress.from(a)}),void 0);return r?new T(r):void 0}async function tt({network:t}){let{aptos:a}=this.getClients({network:t}),e=await a.getGasPriceEstimation();return{deprioritizedGasEstimate:e.deprioritized_gas_estimate,gasEstimate:e.gas_estimate,prioritizedGasEstimate:e.prioritized_gas_estimate}}async function et({network:t,...a}){let{aptos:e}=this.getClients({network:t});return"ledgerVersion"in a?e.getTransactionByVersion({ledgerVersion:a.ledgerVersion}):e.getTransactionByHash({transactionHash:a.transactionHash})}var $e=require("@aptos-labs/ts-sdk");async function at({network:t,accountAddress:a,...e}){let{aptos:r}=this.getClients({network:t});return await r.getAccountResource({...e,accountAddress:$e.AccountAddress.from(a).toString(),resourceType:e.resourceType})}async function rt({network:t,...a}){let{aptos:e}=this.getClients({network:t});return await F(()=>e.getAccountResources(a),[])}async function nt({network:t}){let{aptos:a}=this.getClients({network:t}),e=await a.getLedgerInfo();return{chainId:e.chain_id,epoch:e.epoch,ledgerVersion:e.ledger_version,oldestLedgerVersion:e.oldest_ledger_version,ledgerTimestamp:e.ledger_timestamp,nodeRole:e.node_role,oldestBlockHeight:e.oldest_block_height,blockHeight:e.block_height,gitHash:e.git_hash}}async function _t(t){let{indexer:a}=this.getClients({network:t.network});if(!a)throw new x;let e=await a.getTokenData({address:t.address});if(e.current_token_datas_v2.length!==0)return{...D(e.current_token_datas_v2[0]),createdActivity:e.created_activity.at(0)?Q(e.created_activity[0]):void 0,acquiredActivity:e.acquired_activity.at(0)?Q(e.acquired_activity[0]):void 0}}var Ge=require("@aptos-labs/ts-sdk");var R=class extends C{constructor(){super("No sender found");this.name="SenderNotFoundError"}};async function ot({network:t,limit:a=100,offset:e=0,orderBy:r=[],where:n=[],...d}){let{indexer:o}=this.getClients({network:t});if(!o)throw new x;return k({limit:a,offset:e,queryFn:async({limit:_,offset:c})=>{let p=await o.getAccountCollections({limit:_,offset:c,address:Ge.AccountAddress.from(d.address).toString(),where:n,order_by:[{last_transaction_version:"desc",collection_id:"desc"},...Array.isArray(r)?r:[r]]}),g=[];return p.current_collection_ownership_v2_view.forEach(m=>{m.current_collection&&g.push(U(m.current_collection))}),{hasNextPage:p.current_collection_ownership_v2_view.length===_,collections:g}}})}async function st(t){let{aptos:a}=this.getClients({network:t.network});return await a.view(t)}async function it({network:t,...a}){let{aptos:e}=this.getClients({network:t}),r=await e.getFungibleAssetMetadata({options:{where:{asset_type:{_eq:a.asset}}}});return r.at(0)?q(r[0]):void 0}var ze=require("@aptos-labs/ts-sdk");async function pt({network:t,address:a,limit:e=100,offset:r=0,orderBy:n=[],where:d=[],fungibleAssetActivitiesWhere:o=[],tokenActivitiesWhere:_=[],fungibleAssetActivitiesOrderBy:c=[],tokenActivitiesOrderBy:p=[]}){let{indexer:g}=this.getClients({network:t});if(!g)throw new x;return k({limit:e,offset:r,queryFn:async({limit:m,offset:l})=>{let i=await g.getAccountTransactions({address:ze.AccountAddress.from(a).toString(),limit:m,offset:l,order_by:[{transaction_version:"desc"},...Array.isArray(n)?n:[n]],where:d,fungible_asset_activities_where:o,token_activities_v2_where:_,fungible_asset_activities_order_by:c,token_activities_v2_order_by:p});return{hasNextPage:i.account_transactions.length===m,transactions:i.account_transactions.map(De)}}})}var je=require("@aptos-labs/ts-sdk");async function ut({network:t,address:a,collectionId:e,limit:r=100,offset:n=0,orderBy:d=[],where:o=[]}){let{indexer:_}=this.getClients({network:t});if(!_)throw new x;return k({limit:r,offset:n,queryFn:async({limit:c,offset:p})=>{let g=await _.getAccountTokenOwnerships({address:je.AccountAddress.from(a).toString(),limit:c,offset:p,order_by:d,where:[...e?[{current_token_data:{current_collection:{collection_id:{_eq:e}}}}]:[],...Array.isArray(o)?o:[o]]}),m=[];return g.current_token_ownerships_v2.forEach(l=>{!l.current_token_data||!l.current_token_data.current_collection||m.push({...D(l.current_token_data),amount:l.amount,isSoulbound:l.is_soulbound_v2??!1,ownerAddress:l.owner_address})}),{hasNextPage:g.current_token_ownerships_v2.length===c,tokens:m}}})}var Ue=require("@aptos-labs/ts-sdk");async function yt(t){let{network:a,data:e,options:r,sender:n,withFeePayer:d}=t,{account:o,aptos:_}=this.getClients({network:a}),c=n??o?.address;if(!c)throw new R;let p={...r};return p.expireTimestamp??=Math.floor(this.getServerTime()/1e3)+Ue.DEFAULT_TXN_EXP_SEC_FROM_NOW,"secondarySignerAddresses"in t?_.transaction.build.multiAgent({data:e,options:p,secondarySignerAddresses:t.secondarySignerAddresses,sender:c,withFeePayer:d}):_.transaction.build.simple({data:e,options:p,sender:c,withFeePayer:d})}var L=require("@aptos-labs/ts-sdk");async function ct({network:t,transaction:a}){let{aptos:e}=this.getClients({network:t}),{data:r}=await(0,L.postAptosFullNode)({aptosConfig:e.config,body:a,contentType:L.MimeType.BCS_SIGNED_TRANSACTION,originMethod:"submitTransaction",path:"transactions"});return r}async function lt({network:t,...a}){let{aptos:e}=this.getClients({network:t});return await e.waitForTransaction({...a,transactionHash:a.hash})}async function dt(t){let{aptos:a}=this.getClients({network:t.network});return"secondarySignerAddresses"in t?(await a.transaction.simulate.multiAgent(t))[0]:(await a.transaction.simulate.simple(t))[0]}async function bt({network:t,...a}){let{aptos:e,signer:r}=this.getClients({network:t});if(!r)throw new f;return r.signTransaction({aptos:e,transaction:a.transaction,signer:a.signer})}async function mt(t){let{aptos:a,signer:e}=this.getClients({network:t.network});if(!e)throw new f;let r;return"data"in t?r=await this.buildTransaction(t):r=t.transaction,e.signAndSubmitTransaction({aptos:a,transaction:r,signer:t.signer})}var A,w,V,gt=class{constructor(a){h(this,A);h(this,w);h(this,V);this.getServerTime=()=>(this.state.config?.serverTime??Date.now)();this.getServerDate=()=>new Date(this.getServerTime());this.setAccount=a=>{M(this,A).setState({...this.state,account:a},!0)};this.setNetwork=a=>{M(this,A).setState({...this.state,network:a},!0),this.refreshClients()};this.setSigner=a=>{M(this,A).setState({...this.state,signer:a},!0)};this.setConfig=a=>{M(this,A).setState({...this.state,config:a},!0),this.refreshClients()};this.onAccountChange=a=>M(this,A).subscribe(e=>e.account,e=>a(e));this.onNetworkChange=a=>M(this,A).subscribe(e=>e.network,e=>a(e));this.onSignerChange=a=>M(this,A).subscribe(e=>e.signer,e=>a(e));this.onConfigChange=a=>M(this,A).subscribe(e=>e.config,e=>a(e));this.onChange=a=>M(this,A).subscribe(e=>a(e));this.createNetworkConfig=(a=this.state.network)=>a.network===P.Network.CUSTOM?{network:a.network,fullnode:a.nodeUrl,indexer:a.indexerUrl,faucet:a.faucetUrl,prover:a.proverUrl,pepper:a.pepperUrl}:a;this.createAptos=(a,e=this.state.network)=>{let{state:r}=this,n=this.createNetworkConfig(e),d=r.config?.aptos?.config??{},o=new P.AptosConfig({...n,...d,...a,clientConfig:{...d.clientConfig,API_KEY:r.config?.apiKey,...a?.clientConfig}});return new P.Aptos(o)};this.createIndexer=(a,e=this.state.network)=>{let r=this.createAptos(a,e).config.indexer;if(r===void 0)return;let n=this.state.config?.indexerClient?.options??{},d=this.state?.config?.apiKey?{Authorization:`Bearer ${this.state.config.apiKey}`}:{},o={...n,headers:{...n.headers,...d}};return z(r,o)};this.refreshClients=()=>{B(this,w,this.createAptos()),B(this,V,this.createIndexer())};this.getClients=H;this.fetchAccountTransactions=pt;this.fetchAccountCollections=ot;this.fetchAccountCoins=J;this.fetchAccountTokens=ut;this.fetchTransaction=et;this.fetchResources=rt;this.fetchResourceType=at;this.fetchProcessorStatus=X;this.fetchTokenData=_t;this.fetchFungibleAssetMetadata=it;this.fetchLedgerInfo=nt;this.fetchAddressFromName=Z;this.fetchNameFromAddress=Y;this.fetchAptBalance=W;this.fetchBalance=K;this.fetchEstimatedGasPrice=tt;this.fetchViewModule=st;this.submitTransaction=ct;this.waitForTransaction=lt;this.simulateTransaction=dt;this.signTransaction=bt;this.signAndSubmitTransaction=mt;this.buildTransaction=yt;B(this,A,(0,He.createStore)((0,Je.subscribeWithSelector)(()=>({account:a.account,config:a.config,network:a.network,signer:a.signer})))),B(this,w,this.createAptos()),B(this,V,this.createIndexer())}get state(){return M(this,A).getState()}get store(){return M(this,A)}get signer(){return this.state.signer}get account(){return this.state.account}get network(){return this.state.network}get aptos(){return M(this,w)}get indexer(){return M(this,V)}};A=new WeakMap,w=new WeakMap,V=new WeakMap;var We=require("@aptos-labs/ts-sdk"),Ea=({basePath:t="https://explorer.aptoslabs.com",network:a=We.Network.MAINNET})=>{let e=new URLSearchParams;return e.set("network",a),`${t}/?${e.toString()}`};function Ke(t,a){let[e,r="0"]=t.split("."),n=e.startsWith("-");if(n&&(e=e.slice(1)),r=r.replace(/(0+)$/,""),a===0)Math.round(+`.${r}`)===1&&(e=`${BigInt(e)+BigInt(1)}`),r="";else if(r.length>a){let[d,o,_]=[r.slice(0,a-1),r.slice(a-1,a),r.slice(a)],c=Math.round(+`${o}.${_}`);c>9?r=`${BigInt(d)+BigInt(1)}0`.padStart(d.length+1,"0"):r=`${d}${c}`,r.length>a&&(r=r.slice(1),e=`${BigInt(e)+BigInt(1)}`),r=r.slice(0,a)}else r=r.padEnd(a,"0");return BigInt(`${n?"-":""}${e}${r}`)}var Fa=t=>Ke(t,8),Xe=(t,a)=>{let e=t.toString(),r=e.startsWith("-");r&&(e=e.slice(1)),e=e.padStart(a,"0");let[n,d]=[e.slice(0,e.length-a),e.slice(e.length-a)];return d=d.replace(/(0+)$/,""),`${r?"-":""}${n||"0"}${d?`.${d}`:""}`},wa=t=>Xe(t,8);var Va=t=>t?{address:t.accountAddress,publicKey:t.publicKey}:void 0,Pa=t=>t?{type:"custom",signAndSubmitTransaction:async({aptos:a,signer:e,...r})=>a.signAndSubmitTransaction({signer:e??t,...r}),signTransaction:async({signer:a,transaction:e})=>({rawTransaction:e.rawTransaction.bcsToBytes(),authenticator:(a??t).signTransactionWithAuthenticator(e)})}:void 0;0&&(module.exports={Account_Transactions_Select_Column,Address_Events_Summary_Select_Column,Address_Version_From_Events_Select_Column,Address_Version_From_Move_Resources_Select_Column,AptosBaseError,AptosJSProClient,AptosName,Block_Metadata_Transactions_Select_Column,Coin_Activities_Select_Column,Coin_Activities_Select_Column_Coin_Activities_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Coin_Activities_Select_Column_Coin_Activities_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Coin_Balances_Select_Column,Coin_Infos_Select_Column,Coin_Supply_Select_Column,Collection_Datas_Select_Column,Current_Ans_Lookup_Select_Column,Current_Ans_Lookup_V2_Select_Column,Current_Aptos_Names_Select_Column,Current_Aptos_Names_Select_Column_Current_Aptos_Names_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Current_Aptos_Names_Select_Column_Current_Aptos_Names_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Current_Coin_Balances_Select_Column,Current_Collection_Datas_Select_Column,Current_Collection_Ownership_V2_View_Select_Column,Current_Collections_V2_Select_Column,Current_Delegated_Staking_Pool_Balances_Select_Column,Current_Delegated_Voter_Select_Column,Current_Delegator_Balances_Select_Column,Current_Fungible_Asset_Balances_Select_Column,Current_Objects_Select_Column,Current_Staking_Pool_Voter_Select_Column,Current_Table_Items_Select_Column,Current_Token_Datas_Select_Column,Current_Token_Datas_V2_Select_Column,Current_Token_Ownerships_Select_Column,Current_Token_Ownerships_V2_Select_Column,Current_Token_Ownerships_V2_Select_Column_Current_Token_Ownerships_V2_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Current_Token_Ownerships_V2_Select_Column_Current_Token_Ownerships_V2_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Current_Token_Pending_Claims_Select_Column,Current_Token_Royalty_V1_Select_Column,Cursor_Ordering,Delegated_Staking_Activities_Select_Column,Delegated_Staking_Pool_Balances_Select_Column,Delegated_Staking_Pools_Select_Column,Delegator_Distinct_Pool_Select_Column,Events_Select_Column,Fungible_Asset_Activities_Select_Column,Fungible_Asset_Metadata_Select_Column,IndexerNotInitializedError,Indexer_Status_Select_Column,Ledger_Infos_Select_Column,Move_Resources_Select_Column,Nft_Metadata_Crawler_Parsed_Asset_Uris_Select_Column,Num_Active_Delegator_Per_Pool_Select_Column,Order_By,Processor_Status_Select_Column,Proposal_Votes_Select_Column,SenderNotFoundError,Signatures_Select_Column,SignerNotFoundError,Table_Items_Select_Column,Table_Metadatas_Select_Column,Token_Activities_Select_Column,Token_Activities_V2_Select_Column,Token_Activities_V2_Select_Column_Token_Activities_V2_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Token_Activities_V2_Select_Column_Token_Activities_V2_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Token_Datas_Select_Column,Token_Ownerships_Select_Column,Tokens_Select_Column,User_Transactions_Select_Column,buildTransaction,convertAptosAccountToAccountInfo,convertAptosAccountToSigner,createIndexerClient,fetchAccountCoins,fetchAccountCollections,fetchAccountTokens,fetchAccountTransactions,fetchAddressFromName,fetchAptBalance,fetchBalance,fetchEstimatedGasPrice,fetchFungibleAssetMetadata,fetchLedgerInfo,fetchNameFromAddress,fetchProcessorStatus,fetchResourceType,fetchResources,fetchTokenData,fetchTransaction,fetchViewModule,formatApt,formatUnits,getClients,getExplorerUrl,parseApt,parseUnits,signAndSubmitTransaction,signTransaction,simulateTransaction,submitTransaction,waitForTransaction});
|
|
413
|
+
`,Fa=(t,a,e,r)=>t();function Ct(t,a=Fa){return{getAccountTokensTotal(e,r){return a(n=>t.request(ma,e,{...r,...n}),"getAccountTokensTotal","query",e)},getAccountTokenOwnerships(e,r){return a(n=>t.request(ga,e,{...r,...n}),"getAccountTokenOwnerships","query",e)},getCurrentTokenData(e,r){return a(n=>t.request(Ma,e,{...r,...n}),"getCurrentTokenData","query",e)},getAccountCollections(e,r){return a(n=>t.request(Ia,e,{...r,...n}),"getAccountCollections","query",e)},getTokenData(e,r){return a(n=>t.request(Sa,e,{...r,...n}),"getTokenData","query",e)},getActivitiesAggregate(e,r){return a(n=>t.request(va,e,{...r,...n}),"getActivitiesAggregate","query",e)},getTokenActivities(e,r){return a(n=>t.request(Aa,e,{...r,...n}),"getTokenActivities","query",e)},getTokenAcquisitionActivity(e,r){return a(n=>t.request(xa,e,{...r,...n}),"getTokenAcquisitionActivity","query",e)},getAccountTransactions(e,r){return a(n=>t.request(Ba,e,{...r,...n}),"getAccountTransactions","query",e)},getUserTransactions(e,r){return a(n=>t.request(ka,e,{...r,...n}),"getUserTransactions","query",e)},getFungibleAssetMetadata(e,r){return a(n=>t.request(Ca,e,{...r,...n}),"getFungibleAssetMetadata","query",e)},getFungibleAssetBalances(e,r){return a(n=>t.request(Oa,e,{...r,...n}),"getFungibleAssetBalances","query",e)},getDelegatedStakingRoyalties(e,r){return a(n=>t.request(ha,e,{...r,...n}),"getDelegatedStakingRoyalties","query",e)},getDelegatedStaking(e,r){return a(n=>t.request(fa,e,{...r,...n}),"getDelegatedStaking","query",e)},getDelegationPools(e,r){return a(n=>t.request(Ta,e,{...r,...n}),"getDelegationPools","query",e)},getNumberOfDelegators(e,r){return a(n=>t.request(Ea,e,{...r,...n}),"getNumberOfDelegators","query",e)}}}var Ot=(e=>(e.AccountAddress="account_address",e.TransactionVersion="transaction_version",e))(Ot||{}),ht=(r=>(r.AccountAddress="account_address",r.MinBlockHeight="min_block_height",r.NumDistinctVersions="num_distinct_versions",r))(ht||{}),ft=(e=>(e.AccountAddress="account_address",e.TransactionVersion="transaction_version",e))(ft||{}),Tt=(e=>(e.Address="address",e.TransactionVersion="transaction_version",e))(Tt||{}),Et=(p=>(p.BlockHeight="block_height",p.Epoch="epoch",p.FailedProposerIndices="failed_proposer_indices",p.Id="id",p.PreviousBlockVotesBitvec="previous_block_votes_bitvec",p.Proposer="proposer",p.Round="round",p.Timestamp="timestamp",p.Version="version",p))(Et||{}),Ft=(s=>(s.ActivityType="activity_type",s.Amount="amount",s.BlockHeight="block_height",s.CoinType="coin_type",s.EntryFunctionIdStr="entry_function_id_str",s.EventAccountAddress="event_account_address",s.EventCreationNumber="event_creation_number",s.EventIndex="event_index",s.EventSequenceNumber="event_sequence_number",s.IsGasFee="is_gas_fee",s.IsTransactionSuccess="is_transaction_success",s.OwnerAddress="owner_address",s.StorageRefundAmount="storage_refund_amount",s.TransactionTimestamp="transaction_timestamp",s.TransactionVersion="transaction_version",s))(Ft||{}),wt=(e=>(e.IsGasFee="is_gas_fee",e.IsTransactionSuccess="is_transaction_success",e))(wt||{}),Vt=(e=>(e.IsGasFee="is_gas_fee",e.IsTransactionSuccess="is_transaction_success",e))(Vt||{}),Pt=(o=>(o.Amount="amount",o.CoinType="coin_type",o.CoinTypeHash="coin_type_hash",o.OwnerAddress="owner_address",o.TransactionTimestamp="transaction_timestamp",o.TransactionVersion="transaction_version",o))(Pt||{}),Rt=(g=>(g.CoinType="coin_type",g.CoinTypeHash="coin_type_hash",g.CreatorAddress="creator_address",g.Decimals="decimals",g.Name="name",g.SupplyAggregatorTableHandle="supply_aggregator_table_handle",g.SupplyAggregatorTableKey="supply_aggregator_table_key",g.Symbol="symbol",g.TransactionCreatedTimestamp="transaction_created_timestamp",g.TransactionVersionCreated="transaction_version_created",g))(Rt||{}),Dt=(o=>(o.CoinType="coin_type",o.CoinTypeHash="coin_type_hash",o.Supply="supply",o.TransactionEpoch="transaction_epoch",o.TransactionTimestamp="transaction_timestamp",o.TransactionVersion="transaction_version",o))(Dt||{}),Nt=(i=>(i.CollectionDataIdHash="collection_data_id_hash",i.CollectionName="collection_name",i.CreatorAddress="creator_address",i.Description="description",i.DescriptionMutable="description_mutable",i.Maximum="maximum",i.MaximumMutable="maximum_mutable",i.MetadataUri="metadata_uri",i.Supply="supply",i.TableHandle="table_handle",i.TransactionTimestamp="transaction_timestamp",i.TransactionVersion="transaction_version",i.UriMutable="uri_mutable",i))(Nt||{}),qt=(_=>(_.Domain="domain",_.ExpirationTimestamp="expiration_timestamp",_.IsDeleted="is_deleted",_.LastTransactionVersion="last_transaction_version",_.RegisteredAddress="registered_address",_.Subdomain="subdomain",_.TokenName="token_name",_))(qt||{}),Qt=(c=>(c.Domain="domain",c.ExpirationTimestamp="expiration_timestamp",c.IsDeleted="is_deleted",c.LastTransactionVersion="last_transaction_version",c.RegisteredAddress="registered_address",c.Subdomain="subdomain",c.TokenName="token_name",c.TokenStandard="token_standard",c))(Qt||{}),Lt=(i=>(i.Domain="domain",i.DomainExpirationTimestamp="domain_expiration_timestamp",i.DomainWithSuffix="domain_with_suffix",i.ExpirationTimestamp="expiration_timestamp",i.IsActive="is_active",i.IsPrimary="is_primary",i.LastTransactionVersion="last_transaction_version",i.OwnerAddress="owner_address",i.RegisteredAddress="registered_address",i.Subdomain="subdomain",i.SubdomainExpirationPolicy="subdomain_expiration_policy",i.TokenName="token_name",i.TokenStandard="token_standard",i))(Lt||{}),$t=(e=>(e.IsActive="is_active",e.IsPrimary="is_primary",e))($t||{}),Gt=(e=>(e.IsActive="is_active",e.IsPrimary="is_primary",e))(Gt||{}),Ut=(o=>(o.Amount="amount",o.CoinType="coin_type",o.CoinTypeHash="coin_type_hash",o.LastTransactionTimestamp="last_transaction_timestamp",o.LastTransactionVersion="last_transaction_version",o.OwnerAddress="owner_address",o))(Ut||{}),zt=(i=>(i.CollectionDataIdHash="collection_data_id_hash",i.CollectionName="collection_name",i.CreatorAddress="creator_address",i.Description="description",i.DescriptionMutable="description_mutable",i.LastTransactionTimestamp="last_transaction_timestamp",i.LastTransactionVersion="last_transaction_version",i.Maximum="maximum",i.MaximumMutable="maximum_mutable",i.MetadataUri="metadata_uri",i.Supply="supply",i.TableHandle="table_handle",i.UriMutable="uri_mutable",i))(zt||{}),jt=(c=>(c.CollectionId="collection_id",c.CollectionName="collection_name",c.CollectionUri="collection_uri",c.CreatorAddress="creator_address",c.DistinctTokens="distinct_tokens",c.LastTransactionVersion="last_transaction_version",c.OwnerAddress="owner_address",c.SingleTokenUri="single_token_uri",c))(jt||{}),Jt=(s=>(s.CollectionId="collection_id",s.CollectionName="collection_name",s.CollectionProperties="collection_properties",s.CreatorAddress="creator_address",s.CurrentSupply="current_supply",s.Description="description",s.LastTransactionTimestamp="last_transaction_timestamp",s.LastTransactionVersion="last_transaction_version",s.MaxSupply="max_supply",s.MutableDescription="mutable_description",s.MutableUri="mutable_uri",s.TableHandleV1="table_handle_v1",s.TokenStandard="token_standard",s.TotalMintedV2="total_minted_v2",s.Uri="uri",s))(Jt||{}),Ht=(_=>(_.ActiveTableHandle="active_table_handle",_.InactiveTableHandle="inactive_table_handle",_.LastTransactionVersion="last_transaction_version",_.OperatorCommissionPercentage="operator_commission_percentage",_.StakingPoolAddress="staking_pool_address",_.TotalCoins="total_coins",_.TotalShares="total_shares",_))(Ht||{}),Wt=(_=>(_.DelegationPoolAddress="delegation_pool_address",_.DelegatorAddress="delegator_address",_.LastTransactionTimestamp="last_transaction_timestamp",_.LastTransactionVersion="last_transaction_version",_.PendingVoter="pending_voter",_.TableHandle="table_handle",_.Voter="voter",_))(Wt||{}),Kt=(_=>(_.DelegatorAddress="delegator_address",_.LastTransactionVersion="last_transaction_version",_.ParentTableHandle="parent_table_handle",_.PoolAddress="pool_address",_.PoolType="pool_type",_.Shares="shares",_.TableHandle="table_handle",_))(Kt||{}),Xt=(S=>(S.Amount="amount",S.AmountV1="amount_v1",S.AmountV2="amount_v2",S.AssetType="asset_type",S.AssetTypeV1="asset_type_v1",S.AssetTypeV2="asset_type_v2",S.IsFrozen="is_frozen",S.IsPrimary="is_primary",S.LastTransactionTimestamp="last_transaction_timestamp",S.LastTransactionTimestampV1="last_transaction_timestamp_v1",S.LastTransactionTimestampV2="last_transaction_timestamp_v2",S.LastTransactionVersion="last_transaction_version",S.LastTransactionVersionV1="last_transaction_version_v1",S.LastTransactionVersionV2="last_transaction_version_v2",S.OwnerAddress="owner_address",S.StorageId="storage_id",S.TokenStandard="token_standard",S))(Xt||{}),Zt=(_=>(_.AllowUngatedTransfer="allow_ungated_transfer",_.IsDeleted="is_deleted",_.LastGuidCreationNum="last_guid_creation_num",_.LastTransactionVersion="last_transaction_version",_.ObjectAddress="object_address",_.OwnerAddress="owner_address",_.StateKeyHash="state_key_hash",_))(Zt||{}),Yt=(n=>(n.LastTransactionVersion="last_transaction_version",n.OperatorAddress="operator_address",n.StakingPoolAddress="staking_pool_address",n.VoterAddress="voter_address",n))(Yt||{}),te=(_=>(_.DecodedKey="decoded_key",_.DecodedValue="decoded_value",_.IsDeleted="is_deleted",_.Key="key",_.KeyHash="key_hash",_.LastTransactionVersion="last_transaction_version",_.TableHandle="table_handle",_))(te||{}),ee=(y=>(y.CollectionDataIdHash="collection_data_id_hash",y.CollectionName="collection_name",y.CreatorAddress="creator_address",y.DefaultProperties="default_properties",y.Description="description",y.DescriptionMutable="description_mutable",y.LargestPropertyVersion="largest_property_version",y.LastTransactionTimestamp="last_transaction_timestamp",y.LastTransactionVersion="last_transaction_version",y.Maximum="maximum",y.MaximumMutable="maximum_mutable",y.MetadataUri="metadata_uri",y.Name="name",y.PayeeAddress="payee_address",y.PropertiesMutable="properties_mutable",y.RoyaltyMutable="royalty_mutable",y.RoyaltyPointsDenominator="royalty_points_denominator",y.RoyaltyPointsNumerator="royalty_points_numerator",y.Supply="supply",y.TokenDataIdHash="token_data_id_hash",y.UriMutable="uri_mutable",y))(ee||{}),ae=(s=>(s.CollectionId="collection_id",s.Decimals="decimals",s.Description="description",s.IsDeletedV2="is_deleted_v2",s.IsFungibleV2="is_fungible_v2",s.LargestPropertyVersionV1="largest_property_version_v1",s.LastTransactionTimestamp="last_transaction_timestamp",s.LastTransactionVersion="last_transaction_version",s.Maximum="maximum",s.Supply="supply",s.TokenDataId="token_data_id",s.TokenName="token_name",s.TokenProperties="token_properties",s.TokenStandard="token_standard",s.TokenUri="token_uri",s))(ae||{}),re=(d=>(d.Amount="amount",d.CollectionDataIdHash="collection_data_id_hash",d.CollectionName="collection_name",d.CreatorAddress="creator_address",d.LastTransactionTimestamp="last_transaction_timestamp",d.LastTransactionVersion="last_transaction_version",d.Name="name",d.OwnerAddress="owner_address",d.PropertyVersion="property_version",d.TableType="table_type",d.TokenDataIdHash="token_data_id_hash",d.TokenProperties="token_properties",d))(re||{}),ne=(i=>(i.Amount="amount",i.IsFungibleV2="is_fungible_v2",i.IsSoulboundV2="is_soulbound_v2",i.LastTransactionTimestamp="last_transaction_timestamp",i.LastTransactionVersion="last_transaction_version",i.NonTransferrableByOwner="non_transferrable_by_owner",i.OwnerAddress="owner_address",i.PropertyVersionV1="property_version_v1",i.StorageId="storage_id",i.TableTypeV1="table_type_v1",i.TokenDataId="token_data_id",i.TokenPropertiesMutatedV1="token_properties_mutated_v1",i.TokenStandard="token_standard",i))(ne||{}),_e=(r=>(r.IsFungibleV2="is_fungible_v2",r.IsSoulboundV2="is_soulbound_v2",r.NonTransferrableByOwner="non_transferrable_by_owner",r))(_e||{}),oe=(r=>(r.IsFungibleV2="is_fungible_v2",r.IsSoulboundV2="is_soulbound_v2",r.NonTransferrableByOwner="non_transferrable_by_owner",r))(oe||{}),se=(u=>(u.Amount="amount",u.CollectionDataIdHash="collection_data_id_hash",u.CollectionId="collection_id",u.CollectionName="collection_name",u.CreatorAddress="creator_address",u.FromAddress="from_address",u.LastTransactionTimestamp="last_transaction_timestamp",u.LastTransactionVersion="last_transaction_version",u.Name="name",u.PropertyVersion="property_version",u.TableHandle="table_handle",u.ToAddress="to_address",u.TokenDataId="token_data_id",u.TokenDataIdHash="token_data_id_hash",u))(se||{}),ie=(o=>(o.LastTransactionTimestamp="last_transaction_timestamp",o.LastTransactionVersion="last_transaction_version",o.PayeeAddress="payee_address",o.RoyaltyPointsDenominator="royalty_points_denominator",o.RoyaltyPointsNumerator="royalty_points_numerator",o.TokenDataId="token_data_id",o))(ie||{}),pe=(e=>(e.Asc="ASC",e.Desc="DESC",e))(pe||{}),ue=(o=>(o.Amount="amount",o.DelegatorAddress="delegator_address",o.EventIndex="event_index",o.EventType="event_type",o.PoolAddress="pool_address",o.TransactionVersion="transaction_version",o))(ue||{}),ye=(_=>(_.ActiveTableHandle="active_table_handle",_.InactiveTableHandle="inactive_table_handle",_.OperatorCommissionPercentage="operator_commission_percentage",_.StakingPoolAddress="staking_pool_address",_.TotalCoins="total_coins",_.TotalShares="total_shares",_.TransactionVersion="transaction_version",_))(ye||{}),ce=(e=>(e.FirstTransactionVersion="first_transaction_version",e.StakingPoolAddress="staking_pool_address",e))(ce||{}),le=(e=>(e.DelegatorAddress="delegator_address",e.PoolAddress="pool_address",e))(le||{}),de=(p=>(p.AccountAddress="account_address",p.CreationNumber="creation_number",p.Data="data",p.EventIndex="event_index",p.IndexedType="indexed_type",p.SequenceNumber="sequence_number",p.TransactionBlockHeight="transaction_block_height",p.TransactionVersion="transaction_version",p.Type="type",p))(de||{}),be=(v=>(v.Amount="amount",v.AssetType="asset_type",v.BlockHeight="block_height",v.EntryFunctionIdStr="entry_function_id_str",v.EventIndex="event_index",v.GasFeePayerAddress="gas_fee_payer_address",v.IsFrozen="is_frozen",v.IsGasFee="is_gas_fee",v.IsTransactionSuccess="is_transaction_success",v.OwnerAddress="owner_address",v.StorageId="storage_id",v.StorageRefundAmount="storage_refund_amount",v.TokenStandard="token_standard",v.TransactionTimestamp="transaction_timestamp",v.TransactionVersion="transaction_version",v.Type="type",v))(be||{}),me=(u=>(u.AssetType="asset_type",u.CreatorAddress="creator_address",u.Decimals="decimals",u.IconUri="icon_uri",u.LastTransactionTimestamp="last_transaction_timestamp",u.LastTransactionVersion="last_transaction_version",u.MaximumV2="maximum_v2",u.Name="name",u.ProjectUri="project_uri",u.SupplyAggregatorTableHandleV1="supply_aggregator_table_handle_v1",u.SupplyAggregatorTableKeyV1="supply_aggregator_table_key_v1",u.SupplyV2="supply_v2",u.Symbol="symbol",u.TokenStandard="token_standard",u))(me||{}),ge=(e=>(e.Db="db",e.IsIndexerUp="is_indexer_up",e))(ge||{}),Me=(a=>(a.ChainId="chain_id",a))(Me||{}),Ie=(e=>(e.Address="address",e.TransactionVersion="transaction_version",e))(Ie||{}),Se=(p=>(p.AnimationOptimizerRetryCount="animation_optimizer_retry_count",p.AssetUri="asset_uri",p.CdnAnimationUri="cdn_animation_uri",p.CdnImageUri="cdn_image_uri",p.CdnJsonUri="cdn_json_uri",p.ImageOptimizerRetryCount="image_optimizer_retry_count",p.JsonParserRetryCount="json_parser_retry_count",p.RawAnimationUri="raw_animation_uri",p.RawImageUri="raw_image_uri",p))(Se||{}),ve=(e=>(e.NumActiveDelegator="num_active_delegator",e.PoolAddress="pool_address",e))(ve||{}),N=(o=>(o.Asc="asc",o.AscNullsFirst="asc_nulls_first",o.AscNullsLast="asc_nulls_last",o.Desc="desc",o.DescNullsFirst="desc_nulls_first",o.DescNullsLast="desc_nulls_last",o))(N||{}),Ae=(n=>(n.LastSuccessVersion="last_success_version",n.LastTransactionTimestamp="last_transaction_timestamp",n.LastUpdated="last_updated",n.Processor="processor",n))(Ae||{}),xe=(_=>(_.NumVotes="num_votes",_.ProposalId="proposal_id",_.ShouldPass="should_pass",_.StakingPoolAddress="staking_pool_address",_.TransactionTimestamp="transaction_timestamp",_.TransactionVersion="transaction_version",_.VoterAddress="voter_address",_))(xe||{}),Be=(m=>(m.IsSenderPrimary="is_sender_primary",m.MultiAgentIndex="multi_agent_index",m.MultiSigIndex="multi_sig_index",m.PublicKey="public_key",m.PublicKeyIndices="public_key_indices",m.Signature="signature",m.Signer="signer",m.Threshold="threshold",m.TransactionBlockHeight="transaction_block_height",m.TransactionVersion="transaction_version",m.Type="type",m))(Be||{}),ke=(o=>(o.DecodedKey="decoded_key",o.DecodedValue="decoded_value",o.Key="key",o.TableHandle="table_handle",o.TransactionVersion="transaction_version",o.WriteSetChangeIndex="write_set_change_index",o))(ke||{}),Ce=(r=>(r.Handle="handle",r.KeyType="key_type",r.ValueType="value_type",r))(Ce||{}),Oe=(I=>(I.CoinAmount="coin_amount",I.CoinType="coin_type",I.CollectionDataIdHash="collection_data_id_hash",I.CollectionName="collection_name",I.CreatorAddress="creator_address",I.EventAccountAddress="event_account_address",I.EventCreationNumber="event_creation_number",I.EventIndex="event_index",I.EventSequenceNumber="event_sequence_number",I.FromAddress="from_address",I.Name="name",I.PropertyVersion="property_version",I.ToAddress="to_address",I.TokenAmount="token_amount",I.TokenDataIdHash="token_data_id_hash",I.TransactionTimestamp="transaction_timestamp",I.TransactionVersion="transaction_version",I.TransferType="transfer_type",I))(Oe||{}),he=(s=>(s.AfterValue="after_value",s.BeforeValue="before_value",s.EntryFunctionIdStr="entry_function_id_str",s.EventAccountAddress="event_account_address",s.EventIndex="event_index",s.FromAddress="from_address",s.IsFungibleV2="is_fungible_v2",s.PropertyVersionV1="property_version_v1",s.ToAddress="to_address",s.TokenAmount="token_amount",s.TokenDataId="token_data_id",s.TokenStandard="token_standard",s.TransactionTimestamp="transaction_timestamp",s.TransactionVersion="transaction_version",s.Type="type",s))(he||{}),fe=(a=>(a.IsFungibleV2="is_fungible_v2",a))(fe||{}),Te=(a=>(a.IsFungibleV2="is_fungible_v2",a))(Te||{}),Ee=(y=>(y.CollectionDataIdHash="collection_data_id_hash",y.CollectionName="collection_name",y.CreatorAddress="creator_address",y.DefaultProperties="default_properties",y.Description="description",y.DescriptionMutable="description_mutable",y.LargestPropertyVersion="largest_property_version",y.Maximum="maximum",y.MaximumMutable="maximum_mutable",y.MetadataUri="metadata_uri",y.Name="name",y.PayeeAddress="payee_address",y.PropertiesMutable="properties_mutable",y.RoyaltyMutable="royalty_mutable",y.RoyaltyPointsDenominator="royalty_points_denominator",y.RoyaltyPointsNumerator="royalty_points_numerator",y.Supply="supply",y.TokenDataIdHash="token_data_id_hash",y.TransactionTimestamp="transaction_timestamp",y.TransactionVersion="transaction_version",y.UriMutable="uri_mutable",y))(Ee||{}),Fe=(d=>(d.Amount="amount",d.CollectionDataIdHash="collection_data_id_hash",d.CollectionName="collection_name",d.CreatorAddress="creator_address",d.Name="name",d.OwnerAddress="owner_address",d.PropertyVersion="property_version",d.TableHandle="table_handle",d.TableType="table_type",d.TokenDataIdHash="token_data_id_hash",d.TransactionTimestamp="transaction_timestamp",d.TransactionVersion="transaction_version",d))(Fe||{}),we=(p=>(p.CollectionDataIdHash="collection_data_id_hash",p.CollectionName="collection_name",p.CreatorAddress="creator_address",p.Name="name",p.PropertyVersion="property_version",p.TokenDataIdHash="token_data_id_hash",p.TokenProperties="token_properties",p.TransactionTimestamp="transaction_timestamp",p.TransactionVersion="transaction_version",p))(we||{}),Ve=(u=>(u.BlockHeight="block_height",u.EntryFunctionContractAddress="entry_function_contract_address",u.EntryFunctionFunctionName="entry_function_function_name",u.EntryFunctionIdStr="entry_function_id_str",u.EntryFunctionModuleName="entry_function_module_name",u.Epoch="epoch",u.ExpirationTimestampSecs="expiration_timestamp_secs",u.GasUnitPrice="gas_unit_price",u.MaxGasAmount="max_gas_amount",u.ParentSignatureType="parent_signature_type",u.Sender="sender",u.SequenceNumber="sequence_number",u.Timestamp="timestamp",u.Version="version",u))(Ve||{});function U(t,a){let e=new Pe.GraphQLClient(t,a);return Ct(e)}var Le=require("@aptos-labs/ts-sdk");var B=async({limit:t,offset:a,queryFn:e})=>{let r=await e({limit:t,offset:a}),{hasNextPage:n,hasPrevPage:l,...o}=r,_=n?a+t:void 0,c=l??a>0?Math.max(a-t,0):void 0;return{nextCursor:_,prevCursor:c,...o}};var C=class extends Error{constructor(e,r){super();this.docsBaseUrl="https://js-pro-docs.vercel.app/";this.name="AptosJSProError";this.shortMessage=e,this.longMessage=r?.longMessage}};var A=class extends C{constructor(){super("The AptosJSProClient was not initialized with an indexer",{longMessage:"The AptosJSProClient was not initialized with an indexer. Please specify an indexer endpoint when setting up custom networks."});this.name="IndexerNotInitializedError"}},T=class extends C{constructor(){super("The AptosJSProClient was not initialized with a signer",{longMessage:"The AptosJSProClient was not initialized with a signer. Please specify a signer when setting up the client."});this.name="SignerNotFoundError"}};var O,F,E=class{constructor(a,e){f(this,O);f(this,F);if(!a)return;let n=[e,a].filter(Boolean).join(".").toLowerCase().replace(/(\.apt)$/,""),l=/^(?:([a-zA-Z0-9-]+)\.)?([a-zA-Z0-9-]+)$/,o=n.match(l);if(!o)return;let[,_,c]=o;k(this,O,c),k(this,F,_)}toString(){return M(this,O)?this.noSuffix().concat(".apt"):""}noSuffix(){return M(this,O)?M(this,F)?`${M(this,F)}.${M(this,O)}`:M(this,O):""}};O=new WeakMap,F=new WeakMap;var Re="https://www.aptosnames.com/api";function De(t){let a=t.match(/^https:\/\/aptosnames.com\/name\/([^/]+)$/)??t.match(/^https:\/\/aptosnames.com\/api(?:\/[^/]+)?\/v\d+\/metadata\/([^/]+)/);return a?`${Re}/v1/metadata/${a[1]}`:t}var z=t=>t.domain?new E(t.domain,t.subdomain):void 0,q=t=>({assetType:t.asset_type,creatorAddress:t.creator_address,decimals:t.decimals,iconUri:t.icon_uri,name:t.name,projectUri:t.project_uri,symbol:t.symbol,tokenStandard:t.token_standard}),Ne=t=>t.map(a=>({amount:a.amount,amountV1:a.amount_v1,amountV2:a.amount_v2,assetType:a.asset_type,assetTypeV1:a.asset_type_v1,assetTypeV2:a.asset_type_v2,isFrozen:a.is_frozen,isPrimary:a.is_primary,lastTransactionTimestamp:a.last_transaction_timestamp,lastTransactionVersion:a.last_transaction_version,metadata:q(a.metadata),ownerAddress:a.owner_address,tokenStandard:a.token_standard})),j=t=>({cdnImageUri:t.cdn_asset_uris?.cdn_image_uri,collectionId:t.collection_id,collectionName:t.collection_name,creatorAddress:t.creator_address,description:t.description,metadataUri:t.uri,name:t.collection_name,supply:t.max_supply});var R=t=>{let a=De(t.token_uri);return{cdnImageUri:t.cdn_asset_uris?.cdn_image_uri,collection:t.current_collection?.collection_name??"",collectionData:t.current_collection?j(t.current_collection):void 0,collectionId:t.current_collection?.collection_id??"",creator:t.current_collection?.creator_address??"",description:t.description,isFungibleV2:t.is_fungible_v2??!1,isSoulbound:!1,lastTransactionTimestamp:t.last_transaction_timestamp,lastTransactionVersion:t.last_transaction_version,metadataUri:a,name:t.token_name,tokenId:t.token_data_id,tokenProperties:t.token_properties,tokenStandard:t.token_standard}},Q=t=>({fromAddress:t.from_address,toAddress:t.to_address,transactionTimestamp:t.transaction_timestamp,transactionVersion:t.transaction_version,type:t.type,eventAccountAddress:t.event_account_address,eventIndex:t.event_index}),qe=t=>{let a=[],e=[],r=[];return t.fungible_asset_activities.forEach(n=>{!n.asset_type||!n.metadata||a.push(wa({...n,asset_type:n.asset_type,metadata:n.metadata}))}),t.token_activities_v2.forEach(n=>{n.current_token_data&&e.push(Va({...n,current_token_data:n.current_token_data}))}),t.delegated_staking_activities.forEach(n=>r.push(Pa(n))),{accountAddress:t.account_address,transactionVersion:t.transaction_version,fungibleAssetActivities:a,tokenActivities:e,delegatedStakingActivities:r,userTransaction:t.user_transaction?{sequenceNumber:t.user_transaction.sequence_number,sender:t.user_transaction.sender,entryFunction:t.user_transaction.entry_function_id_str}:void 0}},wa=t=>({ownerAddress:t.owner_address,ownerPrimaryAptosName:t.owner_primary_aptos_name.at(0)?z(t.owner_primary_aptos_name[0]):void 0,amount:t.amount,type:t.type,blockHeight:t.block_height,assetType:t.asset_type,metadata:q(t.metadata),entryFunctionIdStr:t.entry_function_id_str,eventIndex:t.event_index,isGasFee:t.is_gas_fee,gasFeePayerAddress:t.gas_fee_payer_address,isTransactionSuccess:t.is_transaction_success,transactionTimestamp:t.transaction_timestamp,transactionVersion:t.transaction_version}),Va=t=>({...Q(t),primaryAptosNameFrom:t.primary_aptos_name_from.at(0)?z(t.primary_aptos_name_from[0]):void 0,primaryAptosNameTo:t.primary_aptos_name_to.at(0)?z(t.primary_aptos_name_to[0]):void 0,currentTokenData:R(t.current_token_data),propertyVersionV1:t.property_version_v1,tokenAmount:t.token_amount,tokenDataId:t.token_data_id}),Pa=t=>({delegatorAddress:t.delegator_address,eventIndex:t.event_index,eventType:t.event_type,poolAddress:t.pool_address,transactionVersion:t.transaction_version,amount:t.amount}),Qe=t=>({entryFunction:t.entry_function_id_str,expirationTimestampSecs:t.expiration_timestamp_secs,gasUnitPrice:t.gas_unit_price,maxGasAmount:t.max_gas_amount,parentSignatureType:t.parent_signature_type,version:t.version,timestamp:t.timestamp,sequenceNumber:t.sequence_number,sender:t.sender});async function J({address:t,network:a,limit:e=100,offset:r=0,orderBy:n,where:l}){let{indexer:o}=this.getClients({network:a});if(!o)throw new A;return B({limit:e,offset:r,queryFn:async({limit:_,offset:c})=>{let p=await o.getFungibleAssetBalances({limit:_,offset:c,order_by:n,where:{_and:[{metadata:{asset_type:{_is_null:!1}},owner_address:{_eq:Le.AccountAddress.from(t).toString()}},l??{}]}}),g=p.current_fungible_asset_balances.filter(m=>m.metadata!==void 0&&m.metadata!==null);return{balances:Ne(g),hasNextPage:p.current_fungible_asset_balances.length===_}}})}function H({network:t}={}){let a=this.aptos,e=this.indexer;return t&&(a=this.createAptos(void 0,t),e=this.createIndexer(void 0,t)),{account:this.account,aptos:a,indexer:e,network:t??this.network,signer:this.signer}}var $e=require("@aptos-labs/ts-sdk");async function W({address:t,network:a}){let{aptos:e}=this.getClients({network:a}),r=await e.account.getAccountCoinAmount({accountAddress:$e.AccountAddress.from(t).toString(),coinType:"0x1::aptos_coin::AptosCoin"});return BigInt(r)}var Ge=require("@aptos-labs/ts-sdk");async function K({address:t,asset:a,network:e}){let{aptos:r}=this.getClients({network:e}),n=a.includes("::"),l=await r.account.getAccountCoinAmount({accountAddress:Ge.AccountAddress.from(t).toString(),coinType:n?a:void 0,faMetadataAddress:n?void 0:a});return BigInt(l)}async function X({network:t,processor:a}){let{aptos:e}=this.getClients({network:t}),r=await e.getProcessorStatus(a);return{lastSuccessVersion:r.last_success_version,lastUpdated:r.last_updated}}var Ue=require("@aptos-labs/ts-sdk");var w=async(t,a)=>{try{return await t()}catch{return a}};async function Z({network:t,name:a}){let{aptos:e}=this.getClients({network:t}),r=await w(()=>e.getTargetAddress({name:a.toString()}),void 0);return r?Ue.AccountAddress.from(r):void 0}var ze=require("@aptos-labs/ts-sdk");async function Y({network:t,address:a}){let{aptos:e}=this.getClients({network:t}),r=await w(()=>e.getPrimaryName({address:ze.AccountAddress.from(a)}),void 0);return r?new E(r):void 0}async function tt({network:t}){let{aptos:a}=this.getClients({network:t}),e=await a.getGasPriceEstimation();return{deprioritizedGasEstimate:e.deprioritized_gas_estimate,gasEstimate:e.gas_estimate,prioritizedGasEstimate:e.prioritized_gas_estimate}}async function et({network:t,...a}){let{aptos:e}=this.getClients({network:t});return"ledgerVersion"in a?e.getTransactionByVersion({ledgerVersion:a.ledgerVersion}):e.getTransactionByHash({transactionHash:a.transactionHash})}var je=require("@aptos-labs/ts-sdk");async function at({network:t,accountAddress:a,...e}){let{aptos:r}=this.getClients({network:t});return await r.getAccountResource({...e,accountAddress:je.AccountAddress.from(a).toString(),resourceType:e.resourceType})}async function rt({network:t,...a}){let{aptos:e}=this.getClients({network:t});return await w(()=>e.getAccountResources(a),[])}async function nt({network:t}){let{aptos:a}=this.getClients({network:t}),e=await a.getLedgerInfo();return{chainId:e.chain_id,epoch:e.epoch,ledgerVersion:e.ledger_version,oldestLedgerVersion:e.oldest_ledger_version,ledgerTimestamp:e.ledger_timestamp,nodeRole:e.node_role,oldestBlockHeight:e.oldest_block_height,blockHeight:e.block_height,gitHash:e.git_hash}}async function _t(t){let{indexer:a}=this.getClients({network:t.network});if(!a)throw new A;let e=await a.getTokenData({address:t.address});if(e.current_token_datas_v2.length!==0)return{...R(e.current_token_datas_v2[0]),createdActivity:e.created_activity.at(0)?Q(e.created_activity[0]):void 0,acquiredActivity:e.acquired_activity.at(0)?Q(e.acquired_activity[0]):void 0}}var Je=require("@aptos-labs/ts-sdk");var D=class extends C{constructor(){super("No sender found");this.name="SenderNotFoundError"}};async function ot({network:t,limit:a=100,offset:e=0,orderBy:r=[],where:n=[],...l}){let{indexer:o}=this.getClients({network:t});if(!o)throw new A;return B({limit:a,offset:e,queryFn:async({limit:_,offset:c})=>{let p=await o.getAccountCollections({limit:_,offset:c,address:Je.AccountAddress.from(l.address).toString(),where:n,order_by:[{last_transaction_version:"desc",collection_id:"desc"},...Array.isArray(r)?r:[r]]}),g=[];return p.current_collection_ownership_v2_view.forEach(m=>{m.current_collection&&g.push(j(m.current_collection))}),{hasNextPage:p.current_collection_ownership_v2_view.length===_,collections:g}}})}async function st(t){let{aptos:a}=this.getClients({network:t.network});return await a.view(t)}async function it({network:t,...a}){let{aptos:e}=this.getClients({network:t}),r=await e.getFungibleAssetMetadata({options:{where:{asset_type:{_eq:a.asset}}}});return r.at(0)?q(r[0]):void 0}var He=require("@aptos-labs/ts-sdk");async function pt({network:t,address:a,limit:e=100,offset:r=0,orderBy:n=[],where:l=[],fungibleAssetActivitiesWhere:o=[],tokenActivitiesWhere:_=[],fungibleAssetActivitiesOrderBy:c=[],tokenActivitiesOrderBy:p=[]}){let{indexer:g}=this.getClients({network:t});if(!g)throw new A;return B({limit:e,offset:r,queryFn:async({limit:m,offset:d})=>{let i=await g.getAccountTransactions({address:He.AccountAddress.from(a).toString(),limit:m,offset:d,order_by:[{transaction_version:"desc"},...Array.isArray(n)?n:[n]],where:l,fungible_asset_activities_where:o,token_activities_v2_where:_,fungible_asset_activities_order_by:c,token_activities_v2_order_by:p});return{hasNextPage:i.account_transactions.length===m,transactions:i.account_transactions.map(qe)}}})}var We=require("@aptos-labs/ts-sdk");async function ut({network:t,address:a,collectionId:e,limit:r=100,offset:n=0,orderBy:l=[],where:o=[]}){let{indexer:_}=this.getClients({network:t});if(!_)throw new A;return B({limit:r,offset:n,queryFn:async({limit:c,offset:p})=>{let g=await _.getAccountTokenOwnerships({address:We.AccountAddress.from(a).toString(),limit:c,offset:p,order_by:l,where:[...e?[{current_token_data:{current_collection:{collection_id:{_eq:e}}}}]:[],...Array.isArray(o)?o:[o]]}),m=[];return g.current_token_ownerships_v2.forEach(d=>{!d.current_token_data||!d.current_token_data.current_collection||m.push({...R(d.current_token_data),amount:d.amount,isSoulbound:d.is_soulbound_v2??!1,ownerAddress:d.owner_address})}),{hasNextPage:g.current_token_ownerships_v2.length===c,tokens:m}}})}async function yt({network:t,...a}){let{aptos:e}=this.getClients({network:t});return await e.getEvents(a)}async function ct({network:t,limit:a=100,offset:e=0,orderBy:r=[],where:n={}}){let{indexer:l}=this.getClients({network:t});if(!l)throw new A;return B({limit:a,offset:e,queryFn:async({limit:o,offset:_})=>{let c=await l.getUserTransactions({limit:o,offset:_,order_by:r,where:n});return{hasNextPage:c.user_transactions.length===o,transactions:c.user_transactions.map(Qe)}}})}var Ke=require("@aptos-labs/ts-sdk");async function lt(t){let{network:a,data:e,options:r,sender:n,withFeePayer:l}=t,{account:o,aptos:_}=this.getClients({network:a}),c=n??o?.address;if(!c)throw new D;let p={...r};return p.expireTimestamp??=Math.floor(this.getServerTime()/1e3)+Ke.DEFAULT_TXN_EXP_SEC_FROM_NOW,"secondarySignerAddresses"in t?_.transaction.build.multiAgent({data:e,options:p,secondarySignerAddresses:t.secondarySignerAddresses,sender:c,withFeePayer:l}):_.transaction.build.simple({data:e,options:p,sender:c,withFeePayer:l})}var L=require("@aptos-labs/ts-sdk");async function dt({network:t,transaction:a}){let{aptos:e}=this.getClients({network:t}),{data:r}=await(0,L.postAptosFullNode)({aptosConfig:e.config,body:a,contentType:L.MimeType.BCS_SIGNED_TRANSACTION,originMethod:"submitTransaction",path:"transactions"});return r}async function bt({network:t,...a}){let{aptos:e}=this.getClients({network:t});return await e.waitForTransaction({...a,transactionHash:a.hash})}async function mt(t){let{aptos:a}=this.getClients({network:t.network});return"secondarySignerAddresses"in t?(await a.transaction.simulate.multiAgent(t))[0]:(await a.transaction.simulate.simple(t))[0]}async function gt({network:t,...a}){let{aptos:e,signer:r}=this.getClients({network:t});if(!r)throw new T;return r.signTransaction({aptos:e,transaction:a.transaction,signer:a.signer})}async function Mt(t){let{aptos:a,signer:e}=this.getClients({network:t.network});if(!e)throw new T;let r;if("data"in t){if(e.type==="adapter")return await e.signAndSubmitTransaction({aptos:a,payload:t,signer:t.signer});r=await this.buildTransaction(t)}else r=t.transaction;return e.signAndSubmitTransaction({aptos:a,transaction:r,signer:t.signer})}var x,V,P,It=class{constructor(a){f(this,x);f(this,V);f(this,P);this.getServerTime=()=>(this.state.config?.serverTime??Date.now)();this.getServerDate=()=>new Date(this.getServerTime());this.setAccount=a=>{M(this,x).setState({...this.state,account:a},!0)};this.setNetwork=a=>{M(this,x).setState({...this.state,network:a},!0),this.refreshClients()};this.setSigner=a=>{M(this,x).setState({...this.state,signer:a},!0)};this.setConfig=a=>{M(this,x).setState({...this.state,config:a},!0),this.refreshClients()};this.onAccountChange=a=>M(this,x).subscribe(e=>e.account,e=>a(e));this.onNetworkChange=a=>M(this,x).subscribe(e=>e.network,e=>a(e));this.onSignerChange=a=>M(this,x).subscribe(e=>e.signer,e=>a(e));this.onConfigChange=a=>M(this,x).subscribe(e=>e.config,e=>a(e));this.onChange=a=>M(this,x).subscribe(e=>a(e));this.createNetworkConfig=(a=this.state.network)=>a.network===h.Network.CUSTOM?{network:a.network,fullnode:a.nodeUrl,indexer:a.indexerUrl,faucet:a.faucetUrl,prover:a.proverUrl,pepper:a.pepperUrl}:a;this.createAptos=(a,e=this.state.network)=>{let{state:r}=this,n=this.createNetworkConfig(e),l=r.config?.aptos?.config??{},o=typeof r.config?.apiKey=="string"?r.config?.apiKey:r.config?.apiKey?.[e.network],_=new h.AptosConfig({...n,...l,...a,clientConfig:{...l.clientConfig,API_KEY:o,...a?.clientConfig}});return new h.Aptos(_)};this.createIndexer=(a,e=this.state.network)=>{let r=this.createAptos(a,e).config.getRequestUrl(h.AptosApiType.INDEXER);if(r===void 0)return;let n=typeof this.state.config?.apiKey=="string"?this.state.config?.apiKey:this.state.config?.apiKey?.[e.network],l=this.state.config?.indexerClient?.options??{},o=n?{Authorization:`Bearer ${n}`}:{},_={...l,headers:{...l.headers,...o}};return U(r,_)};this.refreshClients=()=>{k(this,V,this.createAptos()),k(this,P,this.createIndexer())};this.getClients=H;this.fetchAccountTransactions=pt;this.fetchAccountCollections=ot;this.fetchAccountCoins=J;this.fetchAccountTokens=ut;this.fetchTransaction=et;this.fetchResources=rt;this.fetchResourceType=at;this.fetchProcessorStatus=X;this.fetchTokenData=_t;this.fetchFungibleAssetMetadata=it;this.fetchLedgerInfo=nt;this.fetchAddressFromName=Z;this.fetchNameFromAddress=Y;this.fetchAptBalance=W;this.fetchBalance=K;this.fetchEstimatedGasPrice=tt;this.fetchViewModule=st;this.fetchEvents=yt;this.fetchUserTransactions=ct;this.submitTransaction=dt;this.waitForTransaction=bt;this.simulateTransaction=mt;this.signTransaction=gt;this.signAndSubmitTransaction=Mt;this.buildTransaction=lt;k(this,x,(0,Ze.createStore)((0,Xe.subscribeWithSelector)(()=>({account:a.account,config:a.config,network:a.network,signer:a.signer})))),k(this,V,this.createAptos()),k(this,P,this.createIndexer())}get state(){return M(this,x).getState()}get store(){return M(this,x)}get signer(){return this.state.signer}get account(){return this.state.account}get network(){return this.state.network}get aptos(){return M(this,V)}get indexer(){return M(this,P)}};x=new WeakMap,V=new WeakMap,P=new WeakMap;var Ye=require("@aptos-labs/ts-sdk"),Ra=({basePath:t="https://explorer.aptoslabs.com",network:a=Ye.Network.MAINNET,path:e=""})=>{let r=new URLSearchParams;return r.set("network",a),`${t}/${e}?${r.toString()}`};function ta(t,a){let[e,r="0"]=t.split("."),n=e.startsWith("-");if(n&&(e=e.slice(1)),r=r.replace(/(0+)$/,""),a===0)Math.round(+`.${r}`)===1&&(e=`${BigInt(e)+BigInt(1)}`),r="";else if(r.length>a){let[l,o,_]=[r.slice(0,a-1),r.slice(a-1,a),r.slice(a)],c=Math.round(+`${o}.${_}`);c>9?r=`${BigInt(l)+BigInt(1)}0`.padStart(l.length+1,"0"):r=`${l}${c}`,r.length>a&&(r=r.slice(1),e=`${BigInt(e)+BigInt(1)}`),r=r.slice(0,a)}else r=r.padEnd(a,"0");return BigInt(`${n?"-":""}${e}${r}`)}var Da=t=>ta(t,8),ea=(t,a)=>{let e=t.toString(),r=e.startsWith("-");r&&(e=e.slice(1)),e=e.padStart(a,"0");let[n,l]=[e.slice(0,e.length-a),e.slice(e.length-a)];return l=l.replace(/(0+)$/,""),`${r?"-":""}${n||"0"}${l?`.${l}`:""}`},Na=t=>ea(t,8);var qa=t=>t?{address:t.accountAddress,publicKey:t.publicKey}:void 0,Qa=t=>t?{type:"custom",signAndSubmitTransaction:async({aptos:a,signer:e,...r})=>a.signAndSubmitTransaction({signer:e??t,...r}),signTransaction:async({signer:a,transaction:e})=>({rawTransaction:e.rawTransaction.bcsToBytes(),authenticator:(a??t).signTransactionWithAuthenticator(e)})}:void 0;0&&(module.exports={Account_Transactions_Select_Column,Address_Events_Summary_Select_Column,Address_Version_From_Events_Select_Column,Address_Version_From_Move_Resources_Select_Column,AptosBaseError,AptosJSProClient,AptosName,Block_Metadata_Transactions_Select_Column,Coin_Activities_Select_Column,Coin_Activities_Select_Column_Coin_Activities_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Coin_Activities_Select_Column_Coin_Activities_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Coin_Balances_Select_Column,Coin_Infos_Select_Column,Coin_Supply_Select_Column,Collection_Datas_Select_Column,Current_Ans_Lookup_Select_Column,Current_Ans_Lookup_V2_Select_Column,Current_Aptos_Names_Select_Column,Current_Aptos_Names_Select_Column_Current_Aptos_Names_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Current_Aptos_Names_Select_Column_Current_Aptos_Names_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Current_Coin_Balances_Select_Column,Current_Collection_Datas_Select_Column,Current_Collection_Ownership_V2_View_Select_Column,Current_Collections_V2_Select_Column,Current_Delegated_Staking_Pool_Balances_Select_Column,Current_Delegated_Voter_Select_Column,Current_Delegator_Balances_Select_Column,Current_Fungible_Asset_Balances_Select_Column,Current_Objects_Select_Column,Current_Staking_Pool_Voter_Select_Column,Current_Table_Items_Select_Column,Current_Token_Datas_Select_Column,Current_Token_Datas_V2_Select_Column,Current_Token_Ownerships_Select_Column,Current_Token_Ownerships_V2_Select_Column,Current_Token_Ownerships_V2_Select_Column_Current_Token_Ownerships_V2_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Current_Token_Ownerships_V2_Select_Column_Current_Token_Ownerships_V2_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Current_Token_Pending_Claims_Select_Column,Current_Token_Royalty_V1_Select_Column,Cursor_Ordering,Delegated_Staking_Activities_Select_Column,Delegated_Staking_Pool_Balances_Select_Column,Delegated_Staking_Pools_Select_Column,Delegator_Distinct_Pool_Select_Column,Events_Select_Column,Fungible_Asset_Activities_Select_Column,Fungible_Asset_Metadata_Select_Column,IndexerNotInitializedError,Indexer_Status_Select_Column,Ledger_Infos_Select_Column,Move_Resources_Select_Column,Nft_Metadata_Crawler_Parsed_Asset_Uris_Select_Column,Num_Active_Delegator_Per_Pool_Select_Column,Order_By,Processor_Status_Select_Column,Proposal_Votes_Select_Column,SenderNotFoundError,Signatures_Select_Column,SignerNotFoundError,Table_Items_Select_Column,Table_Metadatas_Select_Column,Token_Activities_Select_Column,Token_Activities_V2_Select_Column,Token_Activities_V2_Select_Column_Token_Activities_V2_Aggregate_Bool_Exp_Bool_And_Arguments_Columns,Token_Activities_V2_Select_Column_Token_Activities_V2_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns,Token_Datas_Select_Column,Token_Ownerships_Select_Column,Tokens_Select_Column,User_Transactions_Select_Column,buildTransaction,convertAptosAccountToAccountInfo,convertAptosAccountToSigner,createIndexerClient,fetchAccountCoins,fetchAccountCollections,fetchAccountTokens,fetchAccountTransactions,fetchAddressFromName,fetchAptBalance,fetchBalance,fetchEstimatedGasPrice,fetchEvents,fetchFungibleAssetMetadata,fetchLedgerInfo,fetchNameFromAddress,fetchProcessorStatus,fetchResourceType,fetchResources,fetchTokenData,fetchTransaction,fetchUserTransactions,fetchViewModule,formatApt,formatUnits,getClients,getExplorerUrl,parseApt,parseUnits,signAndSubmitTransaction,signTransaction,simulateTransaction,submitTransaction,waitForTransaction});
|
|
391
414
|
//# sourceMappingURL=index.js.map
|