@aptos-labs/ts-sdk 1.0.0 → 1.1.0
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/README.md +3 -3
- package/dist/browser/index.d.ts +513 -214
- package/dist/browser/index.global.js +25 -25
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +513 -214
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +9 -9
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +4 -11
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/coin.d.mts +3 -3
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +300 -76
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +3 -3
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +0 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +118 -13
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +25 -4
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +4 -0
- package/dist/esm/api/transactionSubmission/helpers.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +23 -2
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +21 -2
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-ZKFDLJ2F.mjs → chunk-2HBIGMDV.mjs} +2 -2
- package/dist/esm/{chunk-MNFGMNYS.mjs → chunk-3O4GKLXA.mjs} +2 -2
- package/dist/esm/chunk-3O4GKLXA.mjs.map +1 -0
- package/dist/esm/{chunk-GMOHGD73.mjs → chunk-4TIQQKXV.mjs} +2 -2
- package/dist/esm/{chunk-DBJTMCAG.mjs → chunk-4VG7DV6F.mjs} +2 -2
- package/dist/esm/{chunk-XKINEFAA.mjs → chunk-4ZYW3BPF.mjs} +2 -2
- package/dist/esm/chunk-4ZYW3BPF.mjs.map +1 -0
- package/dist/esm/chunk-6EMN3BOV.mjs +2 -0
- package/dist/esm/chunk-6EMN3BOV.mjs.map +1 -0
- package/dist/esm/chunk-6MKBROIC.mjs +2 -0
- package/dist/esm/chunk-6MKBROIC.mjs.map +1 -0
- package/dist/esm/{chunk-DYJVDOBH.mjs → chunk-AS7RX4RK.mjs} +2 -2
- package/dist/esm/chunk-AS7RX4RK.mjs.map +1 -0
- package/dist/esm/{chunk-X7QBDRQR.mjs → chunk-BUM2FIHF.mjs} +2 -2
- package/dist/esm/chunk-BV6SCEXY.mjs +2 -0
- package/dist/esm/chunk-BV6SCEXY.mjs.map +1 -0
- package/dist/esm/{chunk-CBAVJ5EN.mjs → chunk-D2XLC3KK.mjs} +2 -2
- package/dist/esm/chunk-EMQWD6KP.mjs +2 -0
- package/dist/esm/chunk-EMQWD6KP.mjs.map +1 -0
- package/dist/esm/chunk-HDNJ4JK4.mjs +2 -0
- package/dist/esm/chunk-HDNJ4JK4.mjs.map +1 -0
- package/dist/esm/{chunk-BA4TDBYB.mjs → chunk-IEL6J6Z3.mjs} +2 -2
- package/dist/esm/{chunk-Q3R3KKKP.mjs → chunk-IPW2YTRD.mjs} +2 -2
- package/dist/esm/{chunk-BDTDWLGO.mjs → chunk-KH3M3YPI.mjs} +2 -2
- package/dist/esm/chunk-KSWQZKMQ.mjs +2 -0
- package/dist/esm/chunk-KSWQZKMQ.mjs.map +1 -0
- package/dist/esm/{chunk-ELWWME6B.mjs → chunk-LUCDRB52.mjs} +2 -2
- package/dist/esm/chunk-LUCDRB52.mjs.map +1 -0
- package/dist/esm/chunk-NZ6RYGJQ.mjs +2 -0
- package/dist/esm/chunk-NZ6RYGJQ.mjs.map +1 -0
- package/dist/esm/chunk-OU4MEM5F.mjs +2 -0
- package/dist/esm/chunk-OU4MEM5F.mjs.map +1 -0
- package/dist/esm/{chunk-PLY7MQKE.mjs → chunk-PJMRQLJ5.mjs} +2 -2
- package/dist/esm/chunk-PJMRQLJ5.mjs.map +1 -0
- package/dist/esm/{chunk-Y5RQOXZH.mjs → chunk-R3SAAJ2N.mjs} +2 -2
- package/dist/esm/{chunk-32A35CPU.mjs → chunk-R4APGSSC.mjs} +2 -2
- package/dist/esm/chunk-SI6QMT4N.mjs +2 -0
- package/dist/esm/chunk-SI6QMT4N.mjs.map +1 -0
- package/dist/esm/{chunk-PZ5JKQSP.mjs → chunk-SMN2QQ4Q.mjs} +1 -1
- package/dist/esm/chunk-SMN2QQ4Q.mjs.map +1 -0
- package/dist/esm/chunk-SODP7NAK.mjs +2 -0
- package/dist/esm/{chunk-W4JEP5GW.mjs.map → chunk-SODP7NAK.mjs.map} +1 -1
- package/dist/esm/{chunk-5IVRKK5V.mjs → chunk-SR7XLV76.mjs} +2 -2
- package/dist/esm/{chunk-LBNMY7EM.mjs → chunk-T3ID6KFN.mjs} +2 -2
- package/dist/esm/{chunk-2AMFCGJ3.mjs → chunk-TCSN7PYL.mjs} +2 -2
- package/dist/esm/chunk-TCSN7PYL.mjs.map +1 -0
- package/dist/esm/chunk-TTDCRLRD.mjs +2 -0
- package/dist/esm/chunk-TTDCRLRD.mjs.map +1 -0
- package/dist/esm/{chunk-NFGAZSSK.mjs → chunk-UZB7CTLX.mjs} +2 -2
- package/dist/esm/chunk-VA4K6DEK.mjs +2 -0
- package/dist/esm/chunk-VA4K6DEK.mjs.map +1 -0
- package/dist/esm/{chunk-7IY2Y73Q.mjs → chunk-VBUKPN4Q.mjs} +2 -2
- package/dist/esm/chunk-VBUKPN4Q.mjs.map +1 -0
- package/dist/esm/{chunk-5SRMD5C6.mjs → chunk-YLI6J47P.mjs} +2 -2
- package/dist/esm/{chunk-4FDIPWVB.mjs → chunk-YLPG6XMH.mjs} +2 -2
- package/dist/esm/{chunk-KR5JAN32.mjs → chunk-ZLYSA7JR.mjs} +2 -2
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account.d.mts +2 -2
- package/dist/esm/core/account.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
- package/dist/esm/core/crypto/anySignature.mjs +1 -1
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +1 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +5 -5
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +2 -2
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +144 -27
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +3 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +4 -2
- package/src/api/ans.ts +9 -9
- package/src/api/aptos.ts +3 -28
- package/src/api/coin.ts +3 -3
- package/src/api/digitalAsset.ts +368 -94
- package/src/api/fungibleAsset.ts +3 -3
- package/src/api/transaction.ts +172 -2
- package/src/api/transactionSubmission/build.ts +25 -4
- package/src/api/transactionSubmission/helpers.ts +31 -0
- package/src/api/transactionSubmission/simulate.ts +26 -20
- package/src/api/transactionSubmission/submit.ts +24 -20
- package/src/client/core.ts +1 -1
- package/src/core/account.ts +2 -2
- package/src/internal/ans.ts +5 -5
- package/src/internal/coin.ts +2 -2
- package/src/internal/digitalAsset.ts +461 -61
- package/src/internal/fungibleAsset.ts +2 -2
- package/src/internal/transactionSubmission.ts +6 -6
- package/src/transactions/management/transactionWorker.ts +2 -9
- package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -4
- package/src/transactions/types.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/esm/api/transactionSubmission.d.mts +0 -113
- package/dist/esm/api/transactionSubmission.mjs +0 -2
- package/dist/esm/chunk-26GRNGPL.mjs +0 -2
- package/dist/esm/chunk-26GRNGPL.mjs.map +0 -1
- package/dist/esm/chunk-2AMFCGJ3.mjs.map +0 -1
- package/dist/esm/chunk-2X3FRUKX.mjs +0 -2
- package/dist/esm/chunk-2X3FRUKX.mjs.map +0 -1
- package/dist/esm/chunk-4XQ5IV6C.mjs +0 -2
- package/dist/esm/chunk-4XQ5IV6C.mjs.map +0 -1
- package/dist/esm/chunk-5X46HDCI.mjs +0 -2
- package/dist/esm/chunk-5X46HDCI.mjs.map +0 -1
- package/dist/esm/chunk-7IY2Y73Q.mjs.map +0 -1
- package/dist/esm/chunk-DYJVDOBH.mjs.map +0 -1
- package/dist/esm/chunk-ELWWME6B.mjs.map +0 -1
- package/dist/esm/chunk-MNFGMNYS.mjs.map +0 -1
- package/dist/esm/chunk-NBSXZKMQ.mjs +0 -2
- package/dist/esm/chunk-NBSXZKMQ.mjs.map +0 -1
- package/dist/esm/chunk-NZ36UN4C.mjs +0 -2
- package/dist/esm/chunk-NZ36UN4C.mjs.map +0 -1
- package/dist/esm/chunk-PEBXSNMJ.mjs +0 -2
- package/dist/esm/chunk-PEBXSNMJ.mjs.map +0 -1
- package/dist/esm/chunk-PLY7MQKE.mjs.map +0 -1
- package/dist/esm/chunk-PZ5JKQSP.mjs.map +0 -1
- package/dist/esm/chunk-TNUGIBLO.mjs +0 -2
- package/dist/esm/chunk-TNUGIBLO.mjs.map +0 -1
- package/dist/esm/chunk-TTICPGX6.mjs +0 -2
- package/dist/esm/chunk-TTICPGX6.mjs.map +0 -1
- package/dist/esm/chunk-UES76WF2.mjs +0 -2
- package/dist/esm/chunk-UES76WF2.mjs.map +0 -1
- package/dist/esm/chunk-W44E6YAW.mjs +0 -2
- package/dist/esm/chunk-W44E6YAW.mjs.map +0 -1
- package/dist/esm/chunk-W4JEP5GW.mjs +0 -2
- package/dist/esm/chunk-WXISFVRU.mjs +0 -2
- package/dist/esm/chunk-WXISFVRU.mjs.map +0 -1
- package/dist/esm/chunk-XKINEFAA.mjs.map +0 -1
- package/src/api/transactionSubmission.ts +0 -121
- /package/dist/esm/api/{transactionSubmission.mjs.map → transactionSubmission/helpers.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZKFDLJ2F.mjs.map → chunk-2HBIGMDV.mjs.map} +0 -0
- /package/dist/esm/{chunk-GMOHGD73.mjs.map → chunk-4TIQQKXV.mjs.map} +0 -0
- /package/dist/esm/{chunk-DBJTMCAG.mjs.map → chunk-4VG7DV6F.mjs.map} +0 -0
- /package/dist/esm/{chunk-X7QBDRQR.mjs.map → chunk-BUM2FIHF.mjs.map} +0 -0
- /package/dist/esm/{chunk-CBAVJ5EN.mjs.map → chunk-D2XLC3KK.mjs.map} +0 -0
- /package/dist/esm/{chunk-BA4TDBYB.mjs.map → chunk-IEL6J6Z3.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3R3KKKP.mjs.map → chunk-IPW2YTRD.mjs.map} +0 -0
- /package/dist/esm/{chunk-BDTDWLGO.mjs.map → chunk-KH3M3YPI.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y5RQOXZH.mjs.map → chunk-R3SAAJ2N.mjs.map} +0 -0
- /package/dist/esm/{chunk-32A35CPU.mjs.map → chunk-R4APGSSC.mjs.map} +0 -0
- /package/dist/esm/{chunk-5IVRKK5V.mjs.map → chunk-SR7XLV76.mjs.map} +0 -0
- /package/dist/esm/{chunk-LBNMY7EM.mjs.map → chunk-T3ID6KFN.mjs.map} +0 -0
- /package/dist/esm/{chunk-NFGAZSSK.mjs.map → chunk-UZB7CTLX.mjs.map} +0 -0
- /package/dist/esm/{chunk-5SRMD5C6.mjs.map → chunk-YLI6J47P.mjs.map} +0 -0
- /package/dist/esm/{chunk-4FDIPWVB.mjs.map → chunk-YLPG6XMH.mjs.map} +0 -0
- /package/dist/esm/{chunk-KR5JAN32.mjs.map → chunk-ZLYSA7JR.mjs.map} +0 -0
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
|
-
import { MoveString,
|
|
12
|
+
import { MoveString, Bool, U64 } from "../bcs";
|
|
13
13
|
import { Account, AccountAddress, AccountAddressInput } from "../core";
|
|
14
|
-
import { InputGenerateTransactionOptions,
|
|
14
|
+
import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types";
|
|
15
15
|
import {
|
|
16
16
|
AnyNumber,
|
|
17
17
|
GetCollectionDataResponse,
|
|
@@ -40,52 +40,41 @@ import { queryIndexer } from "./general";
|
|
|
40
40
|
import { generateTransaction } from "./transactionSubmission";
|
|
41
41
|
import { MAX_U64_BIG_INT } from "../bcs/consts";
|
|
42
42
|
import { CurrentTokenOwnershipsV2BoolExp, TokenActivitiesV2BoolExp } from "../types/generated/types";
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
MoveVector.MoveString([]),
|
|
72
|
-
MoveVector.MoveString([]),
|
|
73
|
-
new MoveVector<MoveVector<U8>>([]),
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
options,
|
|
77
|
-
});
|
|
78
|
-
return transaction;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function getTokenData(args: {
|
|
43
|
+
import { checkOrConvertArgument, parseTypeTag } from "../transactions";
|
|
44
|
+
|
|
45
|
+
// A property type map for the user input and what Move expects
|
|
46
|
+
const PropertyTypeMap = {
|
|
47
|
+
BOOLEAN: "bool",
|
|
48
|
+
U8: "u8",
|
|
49
|
+
U16: "u16",
|
|
50
|
+
U32: "u32",
|
|
51
|
+
U64: "u64",
|
|
52
|
+
U128: "u128",
|
|
53
|
+
U256: "u256",
|
|
54
|
+
ADDRESS: "address",
|
|
55
|
+
STRING: "0x1::string::String",
|
|
56
|
+
// TODO support array/vector property types and values
|
|
57
|
+
// ARRAY: "vector<u8>",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type PropertyType = keyof typeof PropertyTypeMap;
|
|
61
|
+
|
|
62
|
+
// Accepted property value types for user input
|
|
63
|
+
export type PropertyValue = boolean | number | bigint | string | AccountAddress | Array<PropertyValue>;
|
|
64
|
+
|
|
65
|
+
// The default digital asset type to use if non provided
|
|
66
|
+
const defaultDigitalAssetType = "0x4::token::Token";
|
|
67
|
+
|
|
68
|
+
// FETCH QUERIES
|
|
69
|
+
|
|
70
|
+
export async function getDigitalAssetData(args: {
|
|
82
71
|
aptosConfig: AptosConfig;
|
|
83
|
-
|
|
72
|
+
digitalAssetAddress: AccountAddressInput;
|
|
84
73
|
}): Promise<GetTokenDataResponse> {
|
|
85
|
-
const { aptosConfig,
|
|
74
|
+
const { aptosConfig, digitalAssetAddress } = args;
|
|
86
75
|
|
|
87
76
|
const whereCondition: { token_data_id: { _eq: string } } = {
|
|
88
|
-
token_data_id: { _eq: AccountAddress.from(
|
|
77
|
+
token_data_id: { _eq: AccountAddress.from(digitalAssetAddress).toStringLong() },
|
|
89
78
|
};
|
|
90
79
|
|
|
91
80
|
const graphqlQuery = {
|
|
@@ -98,20 +87,20 @@ export async function getTokenData(args: {
|
|
|
98
87
|
const data = await queryIndexer<GetTokenDataQuery>({
|
|
99
88
|
aptosConfig,
|
|
100
89
|
query: graphqlQuery,
|
|
101
|
-
originMethod: "
|
|
90
|
+
originMethod: "getDigitalAssetData",
|
|
102
91
|
});
|
|
103
92
|
|
|
104
93
|
return data.current_token_datas_v2[0];
|
|
105
94
|
}
|
|
106
95
|
|
|
107
|
-
export async function
|
|
96
|
+
export async function getCurrentDigitalAssetOwnership(args: {
|
|
108
97
|
aptosConfig: AptosConfig;
|
|
109
|
-
|
|
98
|
+
digitalAssetAddress: AccountAddressInput;
|
|
110
99
|
}): Promise<GetCurrentTokenOwnershipResponse> {
|
|
111
|
-
const { aptosConfig,
|
|
100
|
+
const { aptosConfig, digitalAssetAddress } = args;
|
|
112
101
|
|
|
113
102
|
const whereCondition: CurrentTokenOwnershipsV2BoolExp = {
|
|
114
|
-
token_data_id: { _eq: AccountAddress.from(
|
|
103
|
+
token_data_id: { _eq: AccountAddress.from(digitalAssetAddress).toStringLong() },
|
|
115
104
|
};
|
|
116
105
|
|
|
117
106
|
const graphqlQuery = {
|
|
@@ -124,13 +113,13 @@ export async function getCurrentTokenOwnership(args: {
|
|
|
124
113
|
const data = await queryIndexer<GetCurrentTokenOwnershipQuery>({
|
|
125
114
|
aptosConfig,
|
|
126
115
|
query: graphqlQuery,
|
|
127
|
-
originMethod: "
|
|
116
|
+
originMethod: "getCurrentDigitalAssetOwnership",
|
|
128
117
|
});
|
|
129
118
|
|
|
130
119
|
return data.current_token_ownerships_v2[0];
|
|
131
120
|
}
|
|
132
121
|
|
|
133
|
-
export async function
|
|
122
|
+
export async function getOwnedDigitalAssets(args: {
|
|
134
123
|
aptosConfig: AptosConfig;
|
|
135
124
|
ownerAddress: AccountAddressInput;
|
|
136
125
|
options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;
|
|
@@ -155,21 +144,21 @@ export async function getOwnedTokens(args: {
|
|
|
155
144
|
const data = await queryIndexer<GetCurrentTokenOwnershipQuery>({
|
|
156
145
|
aptosConfig,
|
|
157
146
|
query: graphqlQuery,
|
|
158
|
-
originMethod: "
|
|
147
|
+
originMethod: "getOwnedDigitalAssets",
|
|
159
148
|
});
|
|
160
149
|
|
|
161
150
|
return data.current_token_ownerships_v2;
|
|
162
151
|
}
|
|
163
152
|
|
|
164
|
-
export async function
|
|
153
|
+
export async function getDigitalAssetActivity(args: {
|
|
165
154
|
aptosConfig: AptosConfig;
|
|
166
|
-
|
|
155
|
+
digitalAssetAddress: AccountAddressInput;
|
|
167
156
|
options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;
|
|
168
157
|
}): Promise<GetTokenActivityResponse> {
|
|
169
|
-
const { aptosConfig,
|
|
158
|
+
const { aptosConfig, digitalAssetAddress, options } = args;
|
|
170
159
|
|
|
171
160
|
const whereCondition: TokenActivitiesV2BoolExp = {
|
|
172
|
-
token_data_id: { _eq: AccountAddress.from(
|
|
161
|
+
token_data_id: { _eq: AccountAddress.from(digitalAssetAddress).toStringLong() },
|
|
173
162
|
};
|
|
174
163
|
|
|
175
164
|
const graphqlQuery = {
|
|
@@ -185,7 +174,7 @@ export async function getTokenActivity(args: {
|
|
|
185
174
|
const data = await queryIndexer<GetTokenActivityQuery>({
|
|
186
175
|
aptosConfig,
|
|
187
176
|
query: graphqlQuery,
|
|
188
|
-
originMethod: "
|
|
177
|
+
originMethod: "getDigitalAssetActivity",
|
|
189
178
|
});
|
|
190
179
|
|
|
191
180
|
return data.token_activities_v2;
|
|
@@ -215,7 +204,7 @@ export async function createCollectionTransaction(
|
|
|
215
204
|
uri: string;
|
|
216
205
|
options?: InputGenerateTransactionOptions;
|
|
217
206
|
} & CreateCollectionOptions,
|
|
218
|
-
): Promise<
|
|
207
|
+
): Promise<SimpleTransaction> {
|
|
219
208
|
const { aptosConfig, options, creator } = args;
|
|
220
209
|
const transaction = await generateTransaction({
|
|
221
210
|
aptosConfig,
|
|
@@ -288,24 +277,435 @@ export async function getCollectionId(args: {
|
|
|
288
277
|
return (await getCollectionData(args)).collection_id;
|
|
289
278
|
}
|
|
290
279
|
|
|
291
|
-
|
|
280
|
+
// TRANSACTIONS
|
|
281
|
+
|
|
282
|
+
export async function mintDigitalAssetTransaction(args: {
|
|
283
|
+
aptosConfig: AptosConfig;
|
|
284
|
+
creator: Account;
|
|
285
|
+
collection: string;
|
|
286
|
+
description: string;
|
|
287
|
+
name: string;
|
|
288
|
+
uri: string;
|
|
289
|
+
propertyKeys?: Array<string>;
|
|
290
|
+
propertyTypes?: Array<PropertyType>;
|
|
291
|
+
propertyValues?: Array<PropertyValue>;
|
|
292
|
+
options?: InputGenerateTransactionOptions;
|
|
293
|
+
}): Promise<SimpleTransaction> {
|
|
294
|
+
const {
|
|
295
|
+
aptosConfig,
|
|
296
|
+
options,
|
|
297
|
+
creator,
|
|
298
|
+
collection,
|
|
299
|
+
description,
|
|
300
|
+
name,
|
|
301
|
+
uri,
|
|
302
|
+
propertyKeys,
|
|
303
|
+
propertyTypes,
|
|
304
|
+
propertyValues,
|
|
305
|
+
} = args;
|
|
306
|
+
const convertedPropertyType = propertyTypes?.map((type) => PropertyTypeMap[type]);
|
|
307
|
+
const transaction = await generateTransaction({
|
|
308
|
+
aptosConfig,
|
|
309
|
+
sender: creator.accountAddress,
|
|
310
|
+
data: {
|
|
311
|
+
function: "0x4::aptos_token::mint",
|
|
312
|
+
functionArguments: [
|
|
313
|
+
collection,
|
|
314
|
+
description,
|
|
315
|
+
name,
|
|
316
|
+
uri,
|
|
317
|
+
propertyKeys ?? [],
|
|
318
|
+
convertedPropertyType ?? [],
|
|
319
|
+
getPropertyValueRaw(propertyValues ?? [], convertedPropertyType ?? []),
|
|
320
|
+
],
|
|
321
|
+
},
|
|
322
|
+
options,
|
|
323
|
+
});
|
|
324
|
+
return transaction;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export async function transferDigitalAssetTransaction(args: {
|
|
292
328
|
aptosConfig: AptosConfig;
|
|
293
329
|
sender: Account;
|
|
294
330
|
digitalAssetAddress: AccountAddressInput;
|
|
295
331
|
recipient: AccountAddress;
|
|
296
332
|
digitalAssetType?: MoveStructId;
|
|
297
333
|
options?: InputGenerateTransactionOptions;
|
|
298
|
-
}): Promise<
|
|
334
|
+
}): Promise<SimpleTransaction> {
|
|
299
335
|
const { aptosConfig, sender, digitalAssetAddress, recipient, digitalAssetType, options } = args;
|
|
300
336
|
const transaction = await generateTransaction({
|
|
301
337
|
aptosConfig,
|
|
302
338
|
sender: sender.accountAddress,
|
|
303
339
|
data: {
|
|
304
340
|
function: "0x1::object::transfer",
|
|
305
|
-
typeArguments: [digitalAssetType ??
|
|
341
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
306
342
|
functionArguments: [digitalAssetAddress, recipient],
|
|
307
343
|
},
|
|
308
344
|
options,
|
|
309
345
|
});
|
|
310
346
|
return transaction;
|
|
311
347
|
}
|
|
348
|
+
|
|
349
|
+
export async function mintSoulBoundTransaction(args: {
|
|
350
|
+
aptosConfig: AptosConfig;
|
|
351
|
+
account: Account;
|
|
352
|
+
collection: string;
|
|
353
|
+
description: string;
|
|
354
|
+
name: string;
|
|
355
|
+
uri: string;
|
|
356
|
+
recipient: AccountAddress;
|
|
357
|
+
propertyKeys?: Array<string>;
|
|
358
|
+
propertyTypes?: Array<PropertyType>;
|
|
359
|
+
propertyValues?: Array<PropertyValue>;
|
|
360
|
+
options?: InputGenerateTransactionOptions;
|
|
361
|
+
}): Promise<SimpleTransaction> {
|
|
362
|
+
const {
|
|
363
|
+
aptosConfig,
|
|
364
|
+
account,
|
|
365
|
+
collection,
|
|
366
|
+
description,
|
|
367
|
+
name,
|
|
368
|
+
uri,
|
|
369
|
+
recipient,
|
|
370
|
+
propertyKeys,
|
|
371
|
+
propertyTypes,
|
|
372
|
+
propertyValues,
|
|
373
|
+
options,
|
|
374
|
+
} = args;
|
|
375
|
+
if (propertyKeys?.length !== propertyValues?.length) {
|
|
376
|
+
throw new Error("Property keys and property values counts do not match");
|
|
377
|
+
}
|
|
378
|
+
if (propertyTypes?.length !== propertyValues?.length) {
|
|
379
|
+
throw new Error("Property types and property values counts do not match");
|
|
380
|
+
}
|
|
381
|
+
const convertedPropertyType = propertyTypes?.map((type) => PropertyTypeMap[type]);
|
|
382
|
+
const transaction = await generateTransaction({
|
|
383
|
+
aptosConfig,
|
|
384
|
+
sender: account.accountAddress,
|
|
385
|
+
data: {
|
|
386
|
+
function: "0x4::aptos_token::mint_soul_bound",
|
|
387
|
+
functionArguments: [
|
|
388
|
+
collection,
|
|
389
|
+
description,
|
|
390
|
+
name,
|
|
391
|
+
uri,
|
|
392
|
+
propertyKeys ?? [],
|
|
393
|
+
convertedPropertyType ?? [],
|
|
394
|
+
getPropertyValueRaw(propertyValues ?? [], convertedPropertyType ?? []),
|
|
395
|
+
recipient,
|
|
396
|
+
],
|
|
397
|
+
},
|
|
398
|
+
options,
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
return transaction;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export async function burnDigitalAssetTransaction(args: {
|
|
405
|
+
aptosConfig: AptosConfig;
|
|
406
|
+
creator: Account;
|
|
407
|
+
digitalAssetAddress: AccountAddressInput;
|
|
408
|
+
digitalAssetType?: MoveStructId;
|
|
409
|
+
options?: InputGenerateTransactionOptions;
|
|
410
|
+
}): Promise<SimpleTransaction> {
|
|
411
|
+
const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args;
|
|
412
|
+
const transaction = await generateTransaction({
|
|
413
|
+
aptosConfig,
|
|
414
|
+
sender: creator.accountAddress,
|
|
415
|
+
data: {
|
|
416
|
+
function: "0x4::aptos_token::burn",
|
|
417
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
418
|
+
functionArguments: [digitalAssetAddress],
|
|
419
|
+
},
|
|
420
|
+
options,
|
|
421
|
+
});
|
|
422
|
+
return transaction;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export async function freezeDigitalAssetTransaferTransaction(args: {
|
|
426
|
+
aptosConfig: AptosConfig;
|
|
427
|
+
creator: Account;
|
|
428
|
+
digitalAssetAddress: AccountAddressInput;
|
|
429
|
+
digitalAssetType?: MoveStructId;
|
|
430
|
+
options?: InputGenerateTransactionOptions;
|
|
431
|
+
}): Promise<SimpleTransaction> {
|
|
432
|
+
const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args;
|
|
433
|
+
const transaction = await generateTransaction({
|
|
434
|
+
aptosConfig,
|
|
435
|
+
sender: creator.accountAddress,
|
|
436
|
+
data: {
|
|
437
|
+
function: "0x4::aptos_token::freeze_transfer",
|
|
438
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
439
|
+
functionArguments: [digitalAssetAddress],
|
|
440
|
+
},
|
|
441
|
+
options,
|
|
442
|
+
});
|
|
443
|
+
return transaction;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export async function unfreezeDigitalAssetTransaferTransaction(args: {
|
|
447
|
+
aptosConfig: AptosConfig;
|
|
448
|
+
creator: Account;
|
|
449
|
+
digitalAssetAddress: AccountAddressInput;
|
|
450
|
+
digitalAssetType?: MoveStructId;
|
|
451
|
+
options?: InputGenerateTransactionOptions;
|
|
452
|
+
}): Promise<SimpleTransaction> {
|
|
453
|
+
const { aptosConfig, creator, digitalAssetAddress, digitalAssetType, options } = args;
|
|
454
|
+
const transaction = await generateTransaction({
|
|
455
|
+
aptosConfig,
|
|
456
|
+
sender: creator.accountAddress,
|
|
457
|
+
data: {
|
|
458
|
+
function: "0x4::aptos_token::unfreeze_transfer",
|
|
459
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
460
|
+
functionArguments: [digitalAssetAddress],
|
|
461
|
+
},
|
|
462
|
+
options,
|
|
463
|
+
});
|
|
464
|
+
return transaction;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export async function setDigitalAssetDescriptionTransaction(args: {
|
|
468
|
+
aptosConfig: AptosConfig;
|
|
469
|
+
creator: Account;
|
|
470
|
+
description: string;
|
|
471
|
+
digitalAssetAddress: AccountAddressInput;
|
|
472
|
+
digitalAssetType?: MoveStructId;
|
|
473
|
+
options?: InputGenerateTransactionOptions;
|
|
474
|
+
}): Promise<SimpleTransaction> {
|
|
475
|
+
const { aptosConfig, creator, description, digitalAssetAddress, digitalAssetType, options } = args;
|
|
476
|
+
const transaction = await generateTransaction({
|
|
477
|
+
aptosConfig,
|
|
478
|
+
sender: creator.accountAddress,
|
|
479
|
+
data: {
|
|
480
|
+
function: "0x4::aptos_token::set_description",
|
|
481
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
482
|
+
functionArguments: [digitalAssetAddress, description],
|
|
483
|
+
},
|
|
484
|
+
options,
|
|
485
|
+
});
|
|
486
|
+
return transaction;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export async function setDigitalAssetNameTransaction(args: {
|
|
490
|
+
aptosConfig: AptosConfig;
|
|
491
|
+
creator: Account;
|
|
492
|
+
name: string;
|
|
493
|
+
digitalAssetAddress: AccountAddressInput;
|
|
494
|
+
digitalAssetType?: MoveStructId;
|
|
495
|
+
options?: InputGenerateTransactionOptions;
|
|
496
|
+
}): Promise<SimpleTransaction> {
|
|
497
|
+
const { aptosConfig, creator, name, digitalAssetAddress, digitalAssetType, options } = args;
|
|
498
|
+
const transaction = await generateTransaction({
|
|
499
|
+
aptosConfig,
|
|
500
|
+
sender: creator.accountAddress,
|
|
501
|
+
data: {
|
|
502
|
+
function: "0x4::aptos_token::set_name",
|
|
503
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
504
|
+
functionArguments: [digitalAssetAddress, name],
|
|
505
|
+
},
|
|
506
|
+
options,
|
|
507
|
+
});
|
|
508
|
+
return transaction;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export async function setDigitalAssetURITransaction(args: {
|
|
512
|
+
aptosConfig: AptosConfig;
|
|
513
|
+
creator: Account;
|
|
514
|
+
uri: string;
|
|
515
|
+
digitalAssetAddress: AccountAddressInput;
|
|
516
|
+
digitalAssetType?: MoveStructId;
|
|
517
|
+
options?: InputGenerateTransactionOptions;
|
|
518
|
+
}): Promise<SimpleTransaction> {
|
|
519
|
+
const { aptosConfig, creator, uri, digitalAssetAddress, digitalAssetType, options } = args;
|
|
520
|
+
const transaction = await generateTransaction({
|
|
521
|
+
aptosConfig,
|
|
522
|
+
sender: creator.accountAddress,
|
|
523
|
+
data: {
|
|
524
|
+
function: "0x4::aptos_token::set_uri",
|
|
525
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
526
|
+
functionArguments: [digitalAssetAddress, uri],
|
|
527
|
+
},
|
|
528
|
+
options,
|
|
529
|
+
});
|
|
530
|
+
return transaction;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export async function addDigitalAssetPropertyTransaction(args: {
|
|
534
|
+
aptosConfig: AptosConfig;
|
|
535
|
+
creator: Account;
|
|
536
|
+
propertyKey: string;
|
|
537
|
+
propertyType: PropertyType;
|
|
538
|
+
propertyValue: PropertyValue;
|
|
539
|
+
digitalAssetAddress: AccountAddressInput;
|
|
540
|
+
digitalAssetType?: MoveStructId;
|
|
541
|
+
options?: InputGenerateTransactionOptions;
|
|
542
|
+
}): Promise<SimpleTransaction> {
|
|
543
|
+
const {
|
|
544
|
+
aptosConfig,
|
|
545
|
+
creator,
|
|
546
|
+
propertyKey,
|
|
547
|
+
propertyType,
|
|
548
|
+
propertyValue,
|
|
549
|
+
digitalAssetAddress,
|
|
550
|
+
digitalAssetType,
|
|
551
|
+
options,
|
|
552
|
+
} = args;
|
|
553
|
+
const transaction = await generateTransaction({
|
|
554
|
+
aptosConfig,
|
|
555
|
+
sender: creator.accountAddress,
|
|
556
|
+
data: {
|
|
557
|
+
function: "0x4::aptos_token::add_property",
|
|
558
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
559
|
+
functionArguments: [
|
|
560
|
+
digitalAssetAddress,
|
|
561
|
+
propertyKey,
|
|
562
|
+
PropertyTypeMap[propertyType],
|
|
563
|
+
getSinglePropertyValueRaw(propertyValue, PropertyTypeMap[propertyType]),
|
|
564
|
+
],
|
|
565
|
+
},
|
|
566
|
+
options,
|
|
567
|
+
});
|
|
568
|
+
return transaction;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export async function removeDigitalAssetPropertyTransaction(args: {
|
|
572
|
+
aptosConfig: AptosConfig;
|
|
573
|
+
creator: Account;
|
|
574
|
+
propertyKey: string;
|
|
575
|
+
digitalAssetAddress: AccountAddressInput;
|
|
576
|
+
digitalAssetType?: MoveStructId;
|
|
577
|
+
options?: InputGenerateTransactionOptions;
|
|
578
|
+
}): Promise<SimpleTransaction> {
|
|
579
|
+
const { aptosConfig, creator, propertyKey, digitalAssetAddress, digitalAssetType, options } = args;
|
|
580
|
+
const transaction = await generateTransaction({
|
|
581
|
+
aptosConfig,
|
|
582
|
+
sender: creator.accountAddress,
|
|
583
|
+
data: {
|
|
584
|
+
function: "0x4::aptos_token::remove_property",
|
|
585
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
586
|
+
functionArguments: [digitalAssetAddress, propertyKey],
|
|
587
|
+
},
|
|
588
|
+
options,
|
|
589
|
+
});
|
|
590
|
+
return transaction;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export async function updateDigitalAssetPropertyTransaction(args: {
|
|
594
|
+
aptosConfig: AptosConfig;
|
|
595
|
+
creator: Account;
|
|
596
|
+
propertyKey: string;
|
|
597
|
+
propertyType: PropertyType;
|
|
598
|
+
propertyValue: PropertyValue;
|
|
599
|
+
digitalAssetAddress: AccountAddressInput;
|
|
600
|
+
digitalAssetType?: MoveStructId;
|
|
601
|
+
options?: InputGenerateTransactionOptions;
|
|
602
|
+
}): Promise<SimpleTransaction> {
|
|
603
|
+
const {
|
|
604
|
+
aptosConfig,
|
|
605
|
+
creator,
|
|
606
|
+
propertyKey,
|
|
607
|
+
propertyType,
|
|
608
|
+
propertyValue,
|
|
609
|
+
digitalAssetAddress,
|
|
610
|
+
digitalAssetType,
|
|
611
|
+
options,
|
|
612
|
+
} = args;
|
|
613
|
+
const transaction = await generateTransaction({
|
|
614
|
+
aptosConfig,
|
|
615
|
+
sender: creator.accountAddress,
|
|
616
|
+
data: {
|
|
617
|
+
function: "0x4::aptos_token::update_property",
|
|
618
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType],
|
|
619
|
+
functionArguments: [
|
|
620
|
+
digitalAssetAddress,
|
|
621
|
+
propertyKey,
|
|
622
|
+
PropertyTypeMap[propertyType],
|
|
623
|
+
getSinglePropertyValueRaw(propertyValue, PropertyTypeMap[propertyType]),
|
|
624
|
+
],
|
|
625
|
+
},
|
|
626
|
+
options,
|
|
627
|
+
});
|
|
628
|
+
return transaction;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export async function addDigitalAssetTypedPropertyTransaction(args: {
|
|
632
|
+
aptosConfig: AptosConfig;
|
|
633
|
+
creator: Account;
|
|
634
|
+
propertyKey: string;
|
|
635
|
+
propertyType: PropertyType;
|
|
636
|
+
propertyValue: PropertyValue;
|
|
637
|
+
digitalAssetAddress: AccountAddressInput;
|
|
638
|
+
digitalAssetType?: MoveStructId;
|
|
639
|
+
options?: InputGenerateTransactionOptions;
|
|
640
|
+
}): Promise<SimpleTransaction> {
|
|
641
|
+
const {
|
|
642
|
+
aptosConfig,
|
|
643
|
+
creator,
|
|
644
|
+
propertyKey,
|
|
645
|
+
propertyType,
|
|
646
|
+
propertyValue,
|
|
647
|
+
digitalAssetAddress,
|
|
648
|
+
digitalAssetType,
|
|
649
|
+
options,
|
|
650
|
+
} = args;
|
|
651
|
+
const transaction = await generateTransaction({
|
|
652
|
+
aptosConfig,
|
|
653
|
+
sender: creator.accountAddress,
|
|
654
|
+
data: {
|
|
655
|
+
function: "0x4::aptos_token::add_typed_property",
|
|
656
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType, PropertyTypeMap[propertyType]],
|
|
657
|
+
functionArguments: [digitalAssetAddress, propertyKey, propertyValue],
|
|
658
|
+
},
|
|
659
|
+
options,
|
|
660
|
+
});
|
|
661
|
+
return transaction;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export async function updateDigitalAssetTypedPropertyTransaction(args: {
|
|
665
|
+
aptosConfig: AptosConfig;
|
|
666
|
+
creator: Account;
|
|
667
|
+
propertyKey: string;
|
|
668
|
+
propertyType: PropertyType;
|
|
669
|
+
propertyValue: PropertyValue;
|
|
670
|
+
digitalAssetAddress: AccountAddressInput;
|
|
671
|
+
digitalAssetType?: MoveStructId;
|
|
672
|
+
options?: InputGenerateTransactionOptions;
|
|
673
|
+
}): Promise<SimpleTransaction> {
|
|
674
|
+
const {
|
|
675
|
+
aptosConfig,
|
|
676
|
+
creator,
|
|
677
|
+
propertyKey,
|
|
678
|
+
propertyType,
|
|
679
|
+
propertyValue,
|
|
680
|
+
digitalAssetAddress,
|
|
681
|
+
digitalAssetType,
|
|
682
|
+
options,
|
|
683
|
+
} = args;
|
|
684
|
+
const transaction = await generateTransaction({
|
|
685
|
+
aptosConfig,
|
|
686
|
+
sender: creator.accountAddress,
|
|
687
|
+
data: {
|
|
688
|
+
function: "0x4::aptos_token::update_typed_property",
|
|
689
|
+
typeArguments: [digitalAssetType ?? defaultDigitalAssetType, PropertyTypeMap[propertyType]],
|
|
690
|
+
functionArguments: [digitalAssetAddress, propertyKey, propertyValue],
|
|
691
|
+
},
|
|
692
|
+
options,
|
|
693
|
+
});
|
|
694
|
+
return transaction;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function getPropertyValueRaw(propertyValues: Array<PropertyValue>, propertyTypes: Array<string>): Array<Uint8Array> {
|
|
698
|
+
const results = new Array<Uint8Array>();
|
|
699
|
+
|
|
700
|
+
propertyTypes.forEach((typ, index) => {
|
|
701
|
+
results.push(getSinglePropertyValueRaw(propertyValues[index], typ));
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
return results;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function getSinglePropertyValueRaw(propertyValue: PropertyValue, propertyType: string): Uint8Array {
|
|
708
|
+
const typeTag = parseTypeTag(propertyType);
|
|
709
|
+
const res = checkOrConvertArgument(propertyValue, typeTag, 0, []);
|
|
710
|
+
return res.bcsToBytes();
|
|
711
|
+
}
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
FungibleAssetMetadataBoolExp,
|
|
35
35
|
} from "../types/generated/types";
|
|
36
36
|
import { Account, AccountAddress } from "../core";
|
|
37
|
-
import { InputGenerateTransactionOptions,
|
|
37
|
+
import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions";
|
|
38
38
|
import { generateTransaction } from "./transactionSubmission";
|
|
39
39
|
|
|
40
40
|
export async function getFungibleAssetMetadata(args: {
|
|
@@ -116,7 +116,7 @@ export async function transferFungibleAsset(args: {
|
|
|
116
116
|
recipient: AccountAddress;
|
|
117
117
|
amount: AnyNumber;
|
|
118
118
|
options?: InputGenerateTransactionOptions;
|
|
119
|
-
}): Promise<
|
|
119
|
+
}): Promise<SimpleTransaction> {
|
|
120
120
|
const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;
|
|
121
121
|
const transaction = await generateTransaction({
|
|
122
122
|
aptosConfig,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file contains the underlying implementations for exposed API surface in
|
|
3
|
-
* the {@link api/
|
|
2
|
+
* This file contains the underlying implementations for exposed submission API surface in
|
|
3
|
+
* the {@link api/transaction}. By moving the methods out into a separate file,
|
|
4
4
|
* other namespaces and processes can access these methods without depending on the entire
|
|
5
|
-
*
|
|
5
|
+
* transaction namespace and without having a dependency cycle error.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { AptosConfig } from "../api/aptosConfig";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
AnyRawTransaction,
|
|
27
27
|
InputSimulateTransactionData,
|
|
28
28
|
InputGenerateTransactionOptions,
|
|
29
|
-
|
|
29
|
+
SimpleTransaction,
|
|
30
30
|
InputGenerateTransactionPayloadDataWithRemoteABI,
|
|
31
31
|
InputSubmitTransactionData,
|
|
32
32
|
InputGenerateMultiAgentRawTransactionData,
|
|
@@ -45,7 +45,7 @@ import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput
|
|
|
45
45
|
*/
|
|
46
46
|
export async function generateTransaction(
|
|
47
47
|
args: { aptosConfig: AptosConfig } & InputGenerateSingleSignerRawTransactionData,
|
|
48
|
-
): Promise<
|
|
48
|
+
): Promise<SimpleTransaction>;
|
|
49
49
|
export async function generateTransaction(
|
|
50
50
|
args: { aptosConfig: AptosConfig } & InputGenerateMultiAgentRawTransactionData,
|
|
51
51
|
): Promise<MultiAgentTransaction>;
|
|
@@ -287,7 +287,7 @@ export async function publicPackageTransaction(args: {
|
|
|
287
287
|
metadataBytes: HexInput;
|
|
288
288
|
moduleBytecode: Array<HexInput>;
|
|
289
289
|
options?: InputGenerateTransactionOptions;
|
|
290
|
-
}): Promise<
|
|
290
|
+
}): Promise<SimpleTransaction> {
|
|
291
291
|
const { aptosConfig, account, metadataBytes, moduleBytecode, options } = args;
|
|
292
292
|
|
|
293
293
|
const totalByteCode = moduleBytecode.map((bytecode) => MoveVector.U8(bytecode));
|
|
@@ -18,11 +18,7 @@ import { Account } from "../../core";
|
|
|
18
18
|
import { waitForTransaction } from "../../internal/transaction";
|
|
19
19
|
import { generateTransaction, signAndSubmitTransaction } from "../../internal/transactionSubmission";
|
|
20
20
|
import { PendingTransactionResponse, TransactionResponse } from "../../types";
|
|
21
|
-
import {
|
|
22
|
-
InputGenerateTransactionOptions,
|
|
23
|
-
InputGenerateTransactionPayloadData,
|
|
24
|
-
SingleSignerTransaction,
|
|
25
|
-
} from "../types";
|
|
21
|
+
import { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData, SimpleTransaction } from "../types";
|
|
26
22
|
import { AccountSequenceNumber } from "./accountSequenceNumber";
|
|
27
23
|
import { AsyncQueue, AsyncQueueCancelledError } from "./asyncQueue";
|
|
28
24
|
|
|
@@ -219,10 +215,7 @@ export class TransactionWorker {
|
|
|
219
215
|
* @param sequenceNumber a sequence number the transaction will be generated with
|
|
220
216
|
* @returns
|
|
221
217
|
*/
|
|
222
|
-
async generateNextTransaction(
|
|
223
|
-
account: Account,
|
|
224
|
-
sequenceNumber: bigint,
|
|
225
|
-
): Promise<SingleSignerTransaction | undefined> {
|
|
218
|
+
async generateNextTransaction(account: Account, sequenceNumber: bigint): Promise<SimpleTransaction | undefined> {
|
|
226
219
|
if (this.transactionsQueue.isEmpty()) return undefined;
|
|
227
220
|
const [transactionData, options] = await this.transactionsQueue.dequeue();
|
|
228
221
|
const transaction = await generateTransaction({
|