@tatumio/flow 2.0.1-alpha.351 → 2.0.1-alpha.353
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +10 -8
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/flow.constants.d.ts +12 -0
- package/src/lib/flow.constants.js +13 -1
- package/src/lib/flow.constants.js.map +1 -1
- package/src/lib/flow.sdk.d.ts +64 -51
- package/src/lib/flow.sdk.errors.d.ts +4 -2
- package/src/lib/flow.sdk.errors.js +8 -5
- package/src/lib/flow.sdk.errors.js.map +1 -1
- package/src/lib/flow.sdk.js +12 -1
- package/src/lib/flow.sdk.js.map +1 -1
- package/src/lib/flow.types.d.ts +56 -0
- package/src/lib/flow.types.js +38 -0
- package/src/lib/flow.types.js.map +1 -0
- package/src/lib/services/flow.blockchain.js +7 -7
- package/src/lib/services/flow.blockchain.js.map +1 -1
- package/src/lib/services/flow.kms.d.ts +11 -9
- package/src/lib/services/flow.kms.js +22 -10
- package/src/lib/services/flow.kms.js.map +1 -1
- package/src/lib/services/flow.provider.d.ts +11 -0
- package/src/lib/services/flow.provider.js +17 -0
- package/src/lib/services/flow.provider.js.map +1 -0
- package/src/lib/services/flow.tx.d.ts +86 -94
- package/src/lib/services/flow.tx.js +389 -307
- package/src/lib/services/flow.tx.js.map +1 -1
- package/src/lib/services/flow.tx.templates.d.ts +1 -0
- package/src/lib/services/flow.tx.templates.js +23 -12
- package/src/lib/services/flow.tx.templates.js.map +1 -1
- package/src/lib/services/flow.virtualAccount.d.ts +31 -0
- package/src/lib/services/flow.virtualAccount.js +20 -0
- package/src/lib/services/flow.virtualAccount.js.map +1 -0
- package/src/lib/utils/flow.utils.d.ts +6 -0
- package/src/lib/utils/flow.utils.js +18 -0
- package/src/lib/utils/flow.utils.js.map +1 -0
package/package.json
CHANGED
@@ -1,25 +1,27 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tatumio/flow",
|
3
|
-
"version": "2.0.1-alpha.
|
3
|
+
"version": "2.0.1-alpha.353",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./src/index.js",
|
6
6
|
"types": "./src/index.d.ts",
|
7
7
|
"dependencies": {
|
8
|
-
"@tatumio/
|
9
|
-
"@tatumio/api-client": "2.0.1-alpha.351",
|
8
|
+
"@tatumio/api-client": "2.0.1-alpha.353",
|
10
9
|
"axios": "^0.26.0",
|
11
10
|
"form-data": "^4.0.0",
|
12
|
-
"@tatumio/shared-
|
11
|
+
"@tatumio/shared-testing-common": "2.0.1-alpha.353",
|
13
12
|
"dedent-js": "^1.0.1",
|
14
|
-
"@tatumio/shared-
|
13
|
+
"@tatumio/shared-core": "2.0.1-alpha.353",
|
14
|
+
"@tatumio/shared-abstract-sdk": "2.0.1-alpha.353",
|
15
15
|
"bignumber.js": "^9.0.2",
|
16
|
-
"@tatumio/shared-blockchain-abstract": "2.0.1-alpha.
|
16
|
+
"@tatumio/shared-blockchain-abstract": "2.0.1-alpha.353",
|
17
17
|
"bip32": "^2.0.5",
|
18
18
|
"bip39": "^3.0.2",
|
19
19
|
"hdkey": "^2.0.1",
|
20
|
-
"@onflow/fcl": "^
|
21
|
-
"@onflow/
|
20
|
+
"@onflow/fcl": "^1.3.2",
|
21
|
+
"@onflow/types": "^1.0.5",
|
22
|
+
"@onflow/util-encode-key": "^1.0.3",
|
22
23
|
"sha3": "^2.1.4",
|
24
|
+
"lodash": "^4.17.21",
|
23
25
|
"tslib": "^2.0.0"
|
24
26
|
},
|
25
27
|
"peerDependencies": {}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/blockchain/flow/src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/blockchain/flow/src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B;AAC9B,2DAAgC"}
|
@@ -9,3 +9,15 @@ export declare enum FlowTxType {
|
|
9
9
|
TRANSFER_NFT = 7,
|
10
10
|
CUSTOM_TX = 8
|
11
11
|
}
|
12
|
+
export declare const FLOW_TESTNET_ADDRESSES: {
|
13
|
+
FlowToken: string;
|
14
|
+
FungibleToken: string;
|
15
|
+
FUSD: string;
|
16
|
+
TatumMultiNFT: string;
|
17
|
+
};
|
18
|
+
export declare const FLOW_MAINNET_ADDRESSES: {
|
19
|
+
FlowToken: string;
|
20
|
+
FungibleToken: string;
|
21
|
+
FUSD: string;
|
22
|
+
TatumMultiNFT: string;
|
23
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.FlowTxType = void 0;
|
3
|
+
exports.FLOW_MAINNET_ADDRESSES = exports.FLOW_TESTNET_ADDRESSES = exports.FlowTxType = void 0;
|
4
4
|
var FlowTxType;
|
5
5
|
(function (FlowTxType) {
|
6
6
|
FlowTxType[FlowTxType["CREATE_ACCOUNT"] = 0] = "CREATE_ACCOUNT";
|
@@ -13,4 +13,16 @@ var FlowTxType;
|
|
13
13
|
FlowTxType[FlowTxType["TRANSFER_NFT"] = 7] = "TRANSFER_NFT";
|
14
14
|
FlowTxType[FlowTxType["CUSTOM_TX"] = 8] = "CUSTOM_TX";
|
15
15
|
})(FlowTxType = exports.FlowTxType || (exports.FlowTxType = {}));
|
16
|
+
exports.FLOW_TESTNET_ADDRESSES = {
|
17
|
+
FlowToken: '0x7e60df042a9c0868',
|
18
|
+
FungibleToken: '0x9a0766d93b6608b7',
|
19
|
+
FUSD: '0xe223d8a629e49c68',
|
20
|
+
TatumMultiNFT: '0x87fe4ebd0cddde06',
|
21
|
+
};
|
22
|
+
exports.FLOW_MAINNET_ADDRESSES = {
|
23
|
+
FlowToken: '0x1654653399040a61',
|
24
|
+
FungibleToken: '0xf233dcee88fe0abe',
|
25
|
+
FUSD: '0x3c5959b568896393',
|
26
|
+
TatumMultiNFT: '0x354e6721564ccd2c',
|
27
|
+
};
|
16
28
|
//# sourceMappingURL=flow.constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flow.constants.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAUX;AAVD,WAAY,UAAU;IACpB,+DAAc,CAAA;IACd,qEAAiB,CAAA;IACjB,mDAAQ,CAAA;IACR,uDAAU,CAAA;IACV,mDAAQ,CAAA;IACR,qEAAiB,CAAA;IACjB,mDAAQ,CAAA;IACR,2DAAY,CAAA;IACZ,qDAAS,CAAA;AACX,CAAC,EAVW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAUrB"}
|
1
|
+
{"version":3,"file":"flow.constants.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAUX;AAVD,WAAY,UAAU;IACpB,+DAAc,CAAA;IACd,qEAAiB,CAAA;IACjB,mDAAQ,CAAA;IACR,uDAAU,CAAA;IACV,mDAAQ,CAAA;IACR,qEAAiB,CAAA;IACjB,mDAAQ,CAAA;IACR,2DAAY,CAAA;IACZ,qDAAS,CAAA;AACX,CAAC,EAVW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAUrB;AAEY,QAAA,sBAAsB,GAAG;IACpC,SAAS,EAAE,oBAAoB;IAC/B,aAAa,EAAE,oBAAoB;IACnC,IAAI,EAAE,oBAAoB;IAC1B,aAAa,EAAE,oBAAoB;CACpC,CAAA;AAEY,QAAA,sBAAsB,GAAG;IACpC,SAAS,EAAE,oBAAoB;IAC/B,aAAa,EAAE,oBAAoB;IACnC,IAAI,EAAE,oBAAoB;IAC1B,aAAa,EAAE,oBAAoB;CACpC,CAAA"}
|
package/src/lib/flow.sdk.d.ts
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
-
import { FlowService } from '@tatumio/api-client';
|
1
|
+
import { BlockchainUtilsService, FlowService } from '@tatumio/api-client';
|
2
2
|
import { SDKArguments } from '@tatumio/shared-abstract-sdk';
|
3
|
-
export
|
3
|
+
export interface FlowSDKArguments extends SDKArguments {
|
4
|
+
testnet: boolean;
|
5
|
+
}
|
6
|
+
export declare const TatumFlowSDK: (args: FlowSDKArguments) => {
|
4
7
|
api: typeof FlowService;
|
5
8
|
kms: {
|
6
|
-
sign(tx: import("@tatumio/api-client").PendingTransaction, fromPrivateKeys: string[]
|
9
|
+
sign(tx: import("@tatumio/api-client").PendingTransaction, fromPrivateKeys: string[]): Promise<{
|
7
10
|
txId: string;
|
8
11
|
address: string;
|
9
12
|
} | {
|
10
13
|
txId: string;
|
11
14
|
}>;
|
12
|
-
getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction[]>;
|
15
|
+
getAllPending(signatures?: string | undefined): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction[]>;
|
13
16
|
get: typeof import("@tatumio/api-client").KeyManagementSystemService.getPendingTransactionToSign;
|
14
17
|
complete: typeof import("@tatumio/api-client").KeyManagementSystemService.completePendingSignature;
|
15
18
|
delete: typeof import("@tatumio/api-client").KeyManagementSystemService.deletePendingTransactionToSign;
|
@@ -17,7 +20,7 @@ export declare const TatumFlowSDK: (args: SDKArguments) => {
|
|
17
20
|
wallet: {
|
18
21
|
generateAddressFromXPub: (xpub: string, i: number) => string;
|
19
22
|
generateAddressFromPrivateKey: (privateKey: string) => string;
|
20
|
-
generateWallet: (mnemonic?: string) => Promise<{
|
23
|
+
generateWallet: (mnemonic?: string | undefined) => Promise<{
|
21
24
|
mnemonic: string;
|
22
25
|
xpub: string;
|
23
26
|
}>;
|
@@ -26,43 +29,40 @@ export declare const TatumFlowSDK: (args: SDKArguments) => {
|
|
26
29
|
transaction: {
|
27
30
|
sign: (pk: string, msg: Buffer) => string;
|
28
31
|
getSigner: (pk: string, address: string, keyId?: number) => {
|
29
|
-
signer: (account:
|
32
|
+
signer: (account: import("./flow.types").Account) => Promise<import("./flow.types").AccountAuthorization>;
|
30
33
|
};
|
31
34
|
getApiSigner: (isPayer: boolean) => {
|
32
|
-
signer: (account:
|
35
|
+
signer: (account: import("./flow.types").Account) => Promise<import("./flow.types").AccountAuthorization>;
|
33
36
|
keyHash: string;
|
34
37
|
};
|
35
|
-
createAccountFromPublicKey: (
|
36
|
-
txId
|
37
|
-
address
|
38
|
-
}>;
|
39
|
-
addPublicKeyToAccount: (testnet: boolean, publicKey: string, signerAddress: string, signerPrivateKey: string, weight?: number, proposer?: (args: any) => any, payer?: (args: any) => any) => Promise<{
|
40
|
-
txId: string;
|
41
|
-
address: string;
|
42
|
-
}>;
|
43
|
-
getNftMetadata: (testnet: boolean, account: string, id: string, contractAddress: string) => Promise<any>;
|
44
|
-
getNftTokenByAddress: (testnet: boolean, account: string, tokenType: string) => Promise<any>;
|
45
|
-
sendNftMintToken: (testnet: boolean, body: import("@tatumio/shared-core").ChainFlowMintNft, proposer?: (isPayer: boolean) => any, payer?: (isPayer: boolean) => any) => Promise<{
|
46
|
-
txId: string;
|
47
|
-
tokenId: string;
|
48
|
-
}>;
|
49
|
-
sendNftMintMultipleToken: (testnet: boolean, body: import("@tatumio/shared-core").ChainFlowMintMultipleNft, proposer?: (isPayer: boolean) => any, payer?: (isPayer: boolean) => any) => Promise<{
|
50
|
-
txId: string;
|
51
|
-
tokenId: number[];
|
52
|
-
}>;
|
53
|
-
sendNftTransferToken: (testnet: boolean, body: import("@tatumio/shared-core").ChainFlowTransferNft, proposer?: (isPayer: boolean) => any, payer?: (isPayer: boolean) => any) => Promise<{
|
54
|
-
txId: string;
|
55
|
-
}>;
|
56
|
-
sendNftBurnToken: (testnet: boolean, body: import("@tatumio/shared-core").ChainFlowBurnNft, proposer?: (isPayer: boolean) => any, payer?: (isPayer: boolean) => any) => Promise<{
|
57
|
-
txId: string;
|
58
|
-
}>;
|
59
|
-
sendCustomTransaction: (testnet: boolean, body: import("@tatumio/shared-core").TransferFlowCustomTx, proposer?: (isPayer: boolean) => any, payer?: (isPayer: boolean) => any) => Promise<{
|
60
|
-
txId: string;
|
61
|
-
events: any[];
|
62
|
-
}>;
|
63
|
-
sendTransaction: (testnet: boolean, body: import("@tatumio/shared-core").TransferFlow, proposer?: (isPayer: boolean) => any, payer?: (isPayer: boolean) => any) => Promise<{
|
64
|
-
txId: string;
|
38
|
+
createAccountFromPublicKey: (body: import("./services/flow.tx").CreateAddressFromPubKey, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").SignatureId | {
|
39
|
+
txId?: string | undefined;
|
40
|
+
address?: string | undefined;
|
65
41
|
}>;
|
42
|
+
addPublicKeyToAccount: (body: import("./services/flow.tx").CreateAddressFromPubKey, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId>;
|
43
|
+
nft: {
|
44
|
+
getNftMetadata: (account: string, id: string, contractAddress: string) => Promise<any>;
|
45
|
+
getNftTokenByAddress: (account: string, tokenType: string) => Promise<any>;
|
46
|
+
sendNftMintToken: (body: import("./services/flow.tx").MintFlowNft, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").FlowMintedResult | import("@tatumio/api-client").SolanaMintedResult | import("@tatumio/api-client").AlgorandMintedResult>;
|
47
|
+
sendNftMintMultipleToken: (body: import("./services/flow.tx").MintMultipleFlowNft, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").FlowMintedMultipleResult>;
|
48
|
+
sendNftTransferToken: (body: import("./services/flow.tx").TransferFlowNft, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId>;
|
49
|
+
sendNftBurnToken: (body: import("./services/flow.tx").BurnFlowNft, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId>;
|
50
|
+
};
|
51
|
+
sendTransaction: (body: import("./services/flow.tx").TransferFlow, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId>;
|
52
|
+
sendCustomTransaction: (body: import("./services/flow.tx").TransferFlowCustomTx, proposer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined, payer?: ((isPayer: boolean) => import("./flow.types").AccountSigner) | undefined) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").SignatureId>;
|
53
|
+
templates: {
|
54
|
+
deployNftTokenTypeWithMinterTxTemplate: (testnet: boolean) => string;
|
55
|
+
metadataNftTokenScript: (testnet: boolean) => string;
|
56
|
+
tokenByAddressNftTokenScript: (testnet: boolean) => string;
|
57
|
+
mintNftTokenTxTemplate: (testnet: boolean) => string;
|
58
|
+
mintMultipleNftTokenTxTemplate: (testnet: boolean) => string;
|
59
|
+
burnNftTokenTxTemplate: (testnet: boolean) => string;
|
60
|
+
transferNftTokenTxTemplate: (testnet: boolean) => string;
|
61
|
+
prepareAddPublicKeyToAccountTxTemplate: () => string;
|
62
|
+
prepareTransferTxTemplate: (testnet: boolean, tokenAddress: string, tokenName: string, tokenStorage: string) => string;
|
63
|
+
prepareBalanceTxTemplate: (testnet: boolean, tokenAddress: string, tokenName: string, tokenStorage: string) => string;
|
64
|
+
prepareCreateAccountWithFUSDFromPublicKeyTxTemplate: (testnet: boolean) => string;
|
65
|
+
};
|
66
66
|
};
|
67
67
|
nft: {
|
68
68
|
deployNFTSmartContract: typeof import("@tatumio/api-client").NftErc721OrCompatibleService.nftDeployErc721;
|
@@ -79,25 +79,38 @@ export declare const TatumFlowSDK: (args: SDKArguments) => {
|
|
79
79
|
getBlock: typeof FlowService.flowGetBlock;
|
80
80
|
getAccount: typeof FlowService.flowGetAccount;
|
81
81
|
getTransaction: typeof FlowService.flowGetRawTransaction;
|
82
|
+
smartContractGetAddress: typeof BlockchainUtilsService.scGetContractAddress;
|
83
|
+
generateAddress: typeof FlowService.flowGenerateAddress;
|
82
84
|
};
|
83
85
|
virtualAccount: {
|
86
|
+
send: (body: Omit<import("@tatumio/api-client").TransferFlowPK, "privateKey"> & Partial<import("@tatumio/api-client").SignatureId & {
|
87
|
+
index: number;
|
88
|
+
}> & Partial<Pick<import("@tatumio/api-client").TransferFlowPK, "privateKey">> & Partial<{
|
89
|
+
mnemonic: string;
|
90
|
+
}>) => Promise<import("@tatumio/api-client").OffchainTransactionResult | import("@tatumio/api-client").OffchainTransactionSignatureResult>;
|
84
91
|
depositAddress: {
|
85
|
-
checkExists: (address: string, index?: number) => Promise<
|
86
|
-
create:
|
87
|
-
createMultiple:
|
88
|
-
assign:
|
89
|
-
remove:
|
90
|
-
getByAccount:
|
92
|
+
checkExists: (address: string, index?: number | undefined) => Promise<any>;
|
93
|
+
create: any;
|
94
|
+
createMultiple: any;
|
95
|
+
assign: any;
|
96
|
+
remove: any;
|
97
|
+
getByAccount: any;
|
91
98
|
};
|
92
99
|
withdrawal: {
|
93
|
-
getAll: (status?: "InProgress" | "Done" | "Cancelled", pageSize?: number, offset?: number) => Promise<
|
94
|
-
broadcast:
|
95
|
-
create:
|
96
|
-
complete:
|
100
|
+
getAll: (status?: "InProgress" | "Done" | "Cancelled" | undefined, pageSize?: number | undefined, offset?: number | undefined) => Promise<any[]>;
|
101
|
+
broadcast: any;
|
102
|
+
create: any;
|
103
|
+
complete: any;
|
97
104
|
};
|
98
|
-
storeTokenAddress:
|
105
|
+
storeTokenAddress: any;
|
106
|
+
};
|
107
|
+
call: {
|
108
|
+
broadcast: (txData: string, signatureId?: string | undefined, proposalKey?: number | undefined) => Promise<{
|
109
|
+
txId: string;
|
110
|
+
failed?: boolean | undefined;
|
111
|
+
}>;
|
99
112
|
};
|
100
|
-
getExchangeRate(basePair?: import("@tatumio/api-client").Fiat): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").ExchangeRate>;
|
113
|
+
getExchangeRate(basePair?: import("@tatumio/api-client").Fiat | undefined): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").ExchangeRate>;
|
101
114
|
storage: {
|
102
115
|
upload: typeof import("@tatumio/api-client").IpfsService.storeIpfs;
|
103
116
|
get: typeof import("@tatumio/api-client").IpfsService.getIpfsData;
|
@@ -174,8 +187,8 @@ export declare const TatumFlowSDK: (args: SDKArguments) => {
|
|
174
187
|
freeze: typeof import("@tatumio/api-client").AccountService.freezeAccount;
|
175
188
|
unfreeze: typeof import("@tatumio/api-client").AccountService.unfreezeAccount;
|
176
189
|
generate: (account: import("@tatumio/api-client").CreateAccount & {
|
177
|
-
xpub?: string;
|
178
|
-
}, generateNewWalletFn: any, generateNewWallet?: boolean, testnet?: boolean, webhookUrl?: string) => Promise<any>;
|
190
|
+
xpub?: string | undefined;
|
191
|
+
}, generateNewWalletFn: any, generateNewWallet?: boolean | undefined, testnet?: boolean | undefined, webhookUrl?: string | undefined) => Promise<any>;
|
179
192
|
};
|
180
193
|
};
|
181
194
|
};
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { SdkError, SdkErrorCode } from '@tatumio/shared-abstract-sdk';
|
2
|
-
export declare type FlowSdkErrorCode = SdkErrorCode.FLOW_MISSING_PRIVATE_KEY | SdkErrorCode.FLOW_MISSING_MNEMONIC;
|
3
2
|
export declare class FlowSdkError extends SdkError {
|
4
|
-
constructor(error
|
3
|
+
constructor({ error, code }: {
|
4
|
+
error?: Error | string;
|
5
|
+
code?: SdkErrorCode;
|
6
|
+
});
|
5
7
|
}
|
@@ -2,17 +2,20 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FlowSdkError = void 0;
|
4
4
|
const shared_abstract_sdk_1 = require("@tatumio/shared-abstract-sdk");
|
5
|
+
const flow_utils_1 = require("./utils/flow.utils");
|
5
6
|
class FlowSdkError extends shared_abstract_sdk_1.SdkError {
|
6
|
-
constructor(error) {
|
7
|
-
if (
|
7
|
+
constructor({ error, code }) {
|
8
|
+
if (error) {
|
9
|
+
const wrapped = flow_utils_1.flowUtils.wrapFlowErrorIfNeeded(error);
|
8
10
|
super({
|
9
|
-
|
11
|
+
originalError: wrapped,
|
12
|
+
originalErrorAsString: wrapped === null || wrapped === void 0 ? void 0 : wrapped.name,
|
13
|
+
code,
|
10
14
|
});
|
11
15
|
}
|
12
16
|
else {
|
13
17
|
super({
|
14
|
-
|
15
|
-
originalErrorAsString: error.name,
|
18
|
+
code: code !== null && code !== void 0 ? code : shared_abstract_sdk_1.SdkErrorCode.COMMON_ERROR,
|
16
19
|
});
|
17
20
|
}
|
18
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flow.sdk.errors.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.sdk.errors.ts"],"names":[],"mappings":";;;AAAA,sEAAqE;
|
1
|
+
{"version":3,"file":"flow.sdk.errors.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.sdk.errors.ts"],"names":[],"mappings":";;;AAAA,sEAAqE;AACrE,mDAA8C;AAE9C,MAAa,YAAa,SAAQ,8BAAQ;IACxC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAmD;QAC1E,IAAI,KAAK,EAAE;YACT,MAAM,OAAO,GAAG,sBAAS,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAA;YAEtD,KAAK,CAAC;gBACJ,aAAa,EAAE,OAAO;gBACtB,qBAAqB,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;gBACpC,IAAI;aACL,CAAC,CAAA;SACH;aAAM;YACL,KAAK,CAAC;gBACJ,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,kCAAY,CAAC,YAAY;aACxC,CAAC,CAAA;SACH;IACH,CAAC;CACF;AAhBD,oCAgBC"}
|
package/src/lib/flow.sdk.js
CHANGED
@@ -8,12 +8,19 @@ const shared_core_1 = require("@tatumio/shared-core");
|
|
8
8
|
const flow_sdk_wallet_1 = require("./services/flow.sdk.wallet");
|
9
9
|
const flow_tx_1 = require("./services/flow.tx");
|
10
10
|
const flow_kms_1 = require("./services/flow.kms");
|
11
|
+
const flow_blockchain_1 = require("./services/flow.blockchain");
|
12
|
+
const flow_provider_1 = require("./services/flow.provider");
|
13
|
+
const flow_virtualAccount_1 = require("./services/flow.virtualAccount");
|
11
14
|
const blockchain = shared_core_1.Blockchain.FLOW;
|
12
15
|
const TatumFlowSDK = (args) => {
|
13
16
|
const api = api_client_1.FlowService;
|
14
17
|
const _a = (0, shared_blockchain_abstract_1.abstractBlockchainSdk)(Object.assign(Object.assign({}, args), { blockchain })), { nft } = _a, abstractSdk = tslib_1.__rest(_a, ["nft"]);
|
18
|
+
const virtualAccount = (0, flow_virtualAccount_1.virtualAccountService)({ blockchain });
|
19
|
+
const provider = (0, flow_provider_1.flowProvider)(Object.assign({}, args));
|
20
|
+
const flowBlockchainCalls = (0, flow_blockchain_1.flowBlockchain)(args);
|
21
|
+
const txService = (0, flow_tx_1.flowTxService)(provider, Object.assign({}, flowBlockchainCalls));
|
15
22
|
const { deployNFTSmartContract, mintNFT, transferNFT, mintMultipleNFTs, burnNFT, getNFTTransaction, getNFTAccountBalance, getNFTMetadataURI, } = nft;
|
16
|
-
return Object.assign(Object.assign({}, abstractSdk), { api, kms: (0, flow_kms_1.flowKmsService)(Object.assign(Object.assign({}, args), { blockchain })), wallet: (0, flow_sdk_wallet_1.flowWallet)(), transaction: (
|
23
|
+
return Object.assign(Object.assign({}, abstractSdk), { api, kms: (0, flow_kms_1.flowKmsService)(Object.assign(Object.assign({}, args), { blockchain })), wallet: (0, flow_sdk_wallet_1.flowWallet)(), transaction: Object.assign({}, txService), nft: {
|
17
24
|
deployNFTSmartContract,
|
18
25
|
mintNFT,
|
19
26
|
transferNFT,
|
@@ -27,6 +34,10 @@ const TatumFlowSDK = (args) => {
|
|
27
34
|
getBlock: api_client_1.FlowService.flowGetBlock,
|
28
35
|
getAccount: api_client_1.FlowService.flowGetAccount,
|
29
36
|
getTransaction: api_client_1.FlowService.flowGetRawTransaction,
|
37
|
+
smartContractGetAddress: api_client_1.BlockchainUtilsService.scGetContractAddress,
|
38
|
+
generateAddress: api_client_1.FlowService.flowGenerateAddress,
|
39
|
+
}, virtualAccount, call: {
|
40
|
+
broadcast: flowBlockchainCalls.broadcast,
|
30
41
|
} });
|
31
42
|
};
|
32
43
|
exports.TatumFlowSDK = TatumFlowSDK;
|
package/src/lib/flow.sdk.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flow.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.sdk.ts"],"names":[],"mappings":";;;;AAAA,
|
1
|
+
{"version":3,"file":"flow.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.sdk.ts"],"names":[],"mappings":";;;;AAAA,oDAAyE;AACzE,oFAA2E;AAC3E,sDAAiD;AAEjD,gEAAuD;AACvD,gDAAkD;AAClD,kDAAoD;AACpD,gEAA2D;AAC3D,4DAAuD;AACvD,wEAAsE;AAEtE,MAAM,UAAU,GAAG,wBAAU,CAAC,IAAI,CAAA;AAM3B,MAAM,YAAY,GAAG,CAAC,I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H,CAAC,CAAA;AApDY,QAAA,YAAY,gBAoDxB"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { PrivateKeyOrSignatureId } from '@tatumio/shared-blockchain-abstract';
|
2
|
+
import { FlowCustomTransactionPK, TransactionHash } from '@tatumio/api-client';
|
3
|
+
export interface Account {
|
4
|
+
addr?: string;
|
5
|
+
}
|
6
|
+
export interface AccountSignature {
|
7
|
+
addr: string;
|
8
|
+
keyId: number;
|
9
|
+
signature: string;
|
10
|
+
}
|
11
|
+
export interface AccountAuthorization {
|
12
|
+
tempId: string;
|
13
|
+
addr: string;
|
14
|
+
keyId: number;
|
15
|
+
signingFunction: (data: {
|
16
|
+
message: string;
|
17
|
+
}) => AccountSignature | Promise<AccountSignature>;
|
18
|
+
}
|
19
|
+
export interface AccountSigner {
|
20
|
+
signer: (account: Account) => Promise<AccountAuthorization>;
|
21
|
+
keyHash?: string;
|
22
|
+
}
|
23
|
+
export declare type Transaction = {
|
24
|
+
code: string;
|
25
|
+
txArgs: FlowArgs[];
|
26
|
+
proposer: AccountAuthorizer;
|
27
|
+
authorizations: AccountAuthorizer[];
|
28
|
+
payer: AccountAuthorizer;
|
29
|
+
keyHash?: string;
|
30
|
+
};
|
31
|
+
export declare type TransactionResult = {
|
32
|
+
id: string;
|
33
|
+
events: {
|
34
|
+
data: any;
|
35
|
+
}[];
|
36
|
+
};
|
37
|
+
export declare type TransactionHashWithAddress = TransactionHash & {
|
38
|
+
address: string;
|
39
|
+
};
|
40
|
+
export declare type AccountAuthorizer = (account: Account) => Promise<AccountAuthorization>;
|
41
|
+
export declare type FlowPrivateKeyOrSignatureId<T extends {
|
42
|
+
privateKey?: string;
|
43
|
+
}> = PrivateKeyOrSignatureId<T> & {
|
44
|
+
account: string;
|
45
|
+
};
|
46
|
+
export declare type FixedFlowCustomTransactionPK = Omit<FlowCustomTransactionPK, 'args'> & {
|
47
|
+
args: FlowArgs[];
|
48
|
+
};
|
49
|
+
declare const types: string[];
|
50
|
+
declare type Types = typeof types[number];
|
51
|
+
export interface FlowArgs {
|
52
|
+
value: string | string[];
|
53
|
+
type: string;
|
54
|
+
subType?: Types;
|
55
|
+
}
|
56
|
+
export {};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const types = [
|
4
|
+
'Identity',
|
5
|
+
'UInt',
|
6
|
+
'Int',
|
7
|
+
'UInt8',
|
8
|
+
'Int8',
|
9
|
+
'UInt16',
|
10
|
+
'Int16',
|
11
|
+
'UInt32',
|
12
|
+
'Int32',
|
13
|
+
'UInt64',
|
14
|
+
'Int64',
|
15
|
+
'UInt128',
|
16
|
+
'Int128',
|
17
|
+
'UInt256',
|
18
|
+
'Int256',
|
19
|
+
'Word8',
|
20
|
+
'Word16',
|
21
|
+
'Word32',
|
22
|
+
'Word64',
|
23
|
+
'UFix64',
|
24
|
+
'Fix64',
|
25
|
+
'String',
|
26
|
+
'Character',
|
27
|
+
'Bool',
|
28
|
+
'Address',
|
29
|
+
'Void',
|
30
|
+
'Optional',
|
31
|
+
'Reference',
|
32
|
+
'Array',
|
33
|
+
'Dictionary',
|
34
|
+
'Event',
|
35
|
+
'Resource',
|
36
|
+
'Struct',
|
37
|
+
];
|
38
|
+
//# sourceMappingURL=flow.types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"flow.types.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/flow/src/lib/flow.types.ts"],"names":[],"mappings":";;AAoDA,MAAM,KAAK,GAAG;IACZ,UAAU;IACV,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,MAAM;IACN,SAAS;IACT,MAAM;IACN,UAAU;IACV,WAAW;IACX,OAAO;IACP,YAAY;IACZ,OAAO;IACP,UAAU;IACV,QAAQ;CACT,CAAA"}
|
@@ -11,20 +11,20 @@ const headers = (xApiKey) => ({
|
|
11
11
|
'x-testnet-type': process.env['TESTNET_TYPE'] || 'ethereum-ropsten',
|
12
12
|
},
|
13
13
|
});
|
14
|
-
const post = (xApiKey, url, body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
15
|
-
const { data } = yield shared_core_1.httpHelper.post(`${baseUrl()}${url}`, body, headers(xApiKey));
|
14
|
+
const post = (xApiKey, url, targetUrl, body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
15
|
+
const { data } = yield shared_core_1.httpHelper.post(`${targetUrl !== null && targetUrl !== void 0 ? targetUrl : baseUrl()}${url}`, body, headers(xApiKey));
|
16
16
|
return data;
|
17
17
|
});
|
18
|
-
const get = (xApiKey, url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
19
|
-
const { data } = yield shared_core_1.httpHelper.get(`${baseUrl()}${url}`, headers(xApiKey));
|
18
|
+
const get = (xApiKey, url, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const { data } = yield shared_core_1.httpHelper.get(`${targetUrl !== null && targetUrl !== void 0 ? targetUrl : baseUrl()}${url}`, headers(xApiKey));
|
20
20
|
return data;
|
21
21
|
});
|
22
22
|
// Flow specific methods performing internal tasks on the API
|
23
23
|
const flowBlockchain = (args) => {
|
24
24
|
return {
|
25
|
-
getSignKey: (isPayer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return get(args.apiKey, `/v3/flow/proposal/${isPayer}
|
26
|
-
signWithKey: (data, isPayer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return post(args.apiKey, '/v3/flow/sign', { data, isPayer }); }),
|
27
|
-
broadcast: (txData, signatureId, proposalKey) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return post(args.apiKey, '/v3/flow/broadcast', { txData, signatureId, proposalKey }); }),
|
25
|
+
getSignKey: (isPayer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return get(args.apiKey, `/v3/flow/proposal/${isPayer}`, args.url); }),
|
26
|
+
signWithKey: (data, isPayer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return post(args.apiKey, '/v3/flow/sign', args.url, { data, isPayer }); }),
|
27
|
+
broadcast: (txData, signatureId, proposalKey) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return post(args.apiKey, '/v3/flow/broadcast', args.url, { txData, signatureId, proposalKey }); }),
|
28
28
|
};
|
29
29
|
};
|
30
30
|
exports.flowBlockchain = flowBlockchain;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flow.blockchain.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/flow/src/lib/services/flow.blockchain.ts"],"names":[],"mappings":";;;;AAAA,sDAAiD;AACjD,oDAAyD;AAGzD,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,gCAAmB,CAAC,GAAG,CAAA;AAE7E,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC;IACpC,OAAO,EAAE;QACP,WAAW,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,gCAAmB,CAAC,OAAO;QACnF,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,kBAAkB;KACpE;CACF,CAAC,CAAA;AAEF,MAAM,IAAI,GAAG,
|
1
|
+
{"version":3,"file":"flow.blockchain.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/flow/src/lib/services/flow.blockchain.ts"],"names":[],"mappings":";;;;AAAA,sDAAiD;AACjD,oDAAyD;AAGzD,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,gCAAmB,CAAC,GAAG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eAAe,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA,GAAA;QACjE,SAAS,EAAE,CACT,MAAc,EACd,WAAoB,EACpB,WAAoB,EACyB,EAAE,0DAC/C,OAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAA,GAAA;KAC1F,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,cAAc,kBAa1B"}
|
@@ -1,17 +1,19 @@
|
|
1
1
|
import { Blockchain } from '@tatumio/shared-core';
|
2
2
|
import { PendingTransaction } from '@tatumio/api-client';
|
3
|
-
|
4
|
-
|
3
|
+
import { FlowSDKArguments } from '@tatumio/flow';
|
4
|
+
declare type TransactionHashPromise = Promise<{
|
5
|
+
txId: string;
|
6
|
+
address: string;
|
7
|
+
} | {
|
8
|
+
txId: string;
|
9
|
+
}>;
|
10
|
+
export declare const flowKmsService: (args: FlowSDKArguments & {
|
5
11
|
blockchain: Blockchain;
|
6
12
|
}) => {
|
7
|
-
sign(tx: PendingTransaction, fromPrivateKeys: string[]
|
8
|
-
|
9
|
-
address: string;
|
10
|
-
} | {
|
11
|
-
txId: string;
|
12
|
-
}>;
|
13
|
-
getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<PendingTransaction[]>;
|
13
|
+
sign(tx: PendingTransaction, fromPrivateKeys: string[]): TransactionHashPromise;
|
14
|
+
getAllPending(signatures?: string | undefined): import("@tatumio/api-client").CancelablePromise<PendingTransaction[]>;
|
14
15
|
get: typeof import("@tatumio/api-client").KeyManagementSystemService.getPendingTransactionToSign;
|
15
16
|
complete: typeof import("@tatumio/api-client").KeyManagementSystemService.completePendingSignature;
|
16
17
|
delete: typeof import("@tatumio/api-client").KeyManagementSystemService.deletePendingTransactionToSign;
|
17
18
|
};
|
19
|
+
export {};
|
@@ -6,29 +6,41 @@ const shared_core_1 = require("@tatumio/shared-core");
|
|
6
6
|
const flow_tx_1 = require("./flow.tx");
|
7
7
|
const shared_blockchain_abstract_1 = require("@tatumio/shared-blockchain-abstract");
|
8
8
|
const flow_constants_1 = require("../flow.constants");
|
9
|
+
const flow_blockchain_1 = require("./flow.blockchain");
|
10
|
+
const flow_provider_1 = require("./flow.provider");
|
9
11
|
const flowKmsService = (args) => {
|
10
|
-
return Object.assign(Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainKms)(args)), { sign(tx, fromPrivateKeys
|
12
|
+
return Object.assign(Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainKms)(args)), { sign(tx, fromPrivateKeys) {
|
11
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
12
14
|
const txWithChain = Object.assign(Object.assign({}, tx), { chain: shared_core_1.Blockchain.FLOW });
|
13
15
|
const { type, body } = JSON.parse(txWithChain.serializedTransaction);
|
14
|
-
const
|
16
|
+
const provider = (0, flow_provider_1.flowProvider)(Object.assign({}, args));
|
17
|
+
const flowBlockchainCalls = (0, flow_blockchain_1.flowBlockchain)(args);
|
18
|
+
const txService = (0, flow_tx_1.flowTxService)(provider, Object.assign({}, flowBlockchainCalls));
|
15
19
|
switch (type) {
|
16
20
|
case flow_constants_1.FlowTxType.CREATE_ACCOUNT:
|
17
|
-
return txService.createAccountFromPublicKey(
|
21
|
+
return (yield txService.createAccountFromPublicKey({
|
22
|
+
publicKey: body.publicKey,
|
23
|
+
account: body.account,
|
24
|
+
privateKey: fromPrivateKeys[0],
|
25
|
+
}));
|
18
26
|
case flow_constants_1.FlowTxType.ADD_PK_TO_ACCOUNT:
|
19
|
-
return txService.addPublicKeyToAccount(
|
27
|
+
return (yield txService.addPublicKeyToAccount({
|
28
|
+
publicKey: body.publicKey,
|
29
|
+
account: body.account,
|
30
|
+
privateKey: fromPrivateKeys[0],
|
31
|
+
}));
|
20
32
|
case flow_constants_1.FlowTxType.TRANSFER:
|
21
|
-
return txService.sendTransaction(
|
33
|
+
return (yield txService.sendTransaction(Object.assign(Object.assign({}, body), { privateKey: fromPrivateKeys[0] })));
|
22
34
|
case flow_constants_1.FlowTxType.TRANSFER_NFT:
|
23
|
-
return txService.sendNftTransferToken(
|
35
|
+
return (yield txService.nft.sendNftTransferToken(Object.assign(Object.assign({}, body), { privateKey: fromPrivateKeys[0] })));
|
24
36
|
case flow_constants_1.FlowTxType.MINT_NFT:
|
25
|
-
return txService.sendNftMintToken(
|
37
|
+
return (yield txService.nft.sendNftMintToken(Object.assign(Object.assign({}, body), { privateKey: fromPrivateKeys[0] })));
|
26
38
|
case flow_constants_1.FlowTxType.MINT_MULTIPLE_NFT:
|
27
|
-
return txService.sendNftMintMultipleToken(
|
39
|
+
return (yield txService.nft.sendNftMintMultipleToken(Object.assign(Object.assign({}, body), { privateKey: fromPrivateKeys[0] })));
|
28
40
|
case flow_constants_1.FlowTxType.BURN_NFT:
|
29
|
-
return txService.sendNftBurnToken(
|
41
|
+
return (yield txService.nft.sendNftBurnToken(Object.assign(Object.assign({}, body), { privateKey: fromPrivateKeys[0] })));
|
30
42
|
default:
|
31
|
-
return txService.sendCustomTransaction(
|
43
|
+
return (yield txService.sendCustomTransaction(Object.assign(Object.assign({}, body), { privateKey: fromPrivateKeys[0] })));
|
32
44
|
}
|
33
45
|
});
|
34
46
|
} });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flow.kms.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/flow/src/lib/services/flow.kms.ts"],"names":[],"mappings":";;;;AAAA,sDAAiD;AACjD,uCAAyC;AACzC,oFAA2E;AAC3E,sDAA8C;
|
1
|
+
{"version":3,"file":"flow.kms.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/flow/src/lib/services/flow.kms.ts"],"names":[],"mappings":";;;;AAAA,sDAAiD;AACjD,uCAAyC;AACzC,oFAA2E;AAC3E,sDAA8C;AAE9C,uDAAkD;AAClD,mDAA8C;AAKvC,MAAM,cAAc,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