@streamflow/stream 7.5.2 → 7.5.3-alpha.43a9937.20250509142428
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/dist/cjs/BaseStreamClient-CQOC8m8V.d.cts +542 -0
- package/dist/cjs/aptos/index.cjs +459 -0
- package/dist/cjs/aptos/index.cjs.map +1 -0
- package/dist/cjs/aptos/index.d.cts +14 -0
- package/dist/cjs/evm/index.cjs +1915 -0
- package/dist/cjs/evm/index.cjs.map +1 -0
- package/dist/cjs/evm/index.d.cts +13 -0
- package/dist/cjs/index-CYu6i--S.d.cts +136 -0
- package/dist/cjs/index-DUVcpIhD.d.cts +203 -0
- package/dist/cjs/index-b7Qo5mCj.d.cts +664 -0
- package/dist/cjs/index-fNLnPKzv.d.cts +213 -0
- package/dist/cjs/index.cjs +7205 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +192 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.cjs +4 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.cjs.map +1 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.d.cts +1234 -0
- package/dist/cjs/solana/index.cjs +3762 -0
- package/dist/cjs/solana/index.cjs.map +1 -0
- package/dist/cjs/solana/index.d.cts +17 -0
- package/dist/cjs/sui/index.cjs +1021 -0
- package/dist/cjs/sui/index.cjs.map +1 -0
- package/dist/cjs/sui/index.d.cts +13 -0
- package/dist/esm/BaseStreamClient-CQOC8m8V.d.ts +542 -0
- package/dist/esm/aptos/index.d.ts +14 -4
- package/dist/esm/aptos/index.js +446 -4
- package/dist/esm/aptos/index.js.map +1 -0
- package/dist/esm/evm/index.d.ts +13 -5
- package/dist/esm/evm/index.js +1902 -5
- package/dist/esm/evm/index.js.map +1 -0
- package/dist/esm/index-BEo0O2IG.d.ts +664 -0
- package/dist/esm/index-CWmb3-x9.d.ts +136 -0
- package/dist/esm/index-Cgv37xlG.d.ts +213 -0
- package/dist/esm/index-D6QYg8hn.d.ts +203 -0
- package/dist/esm/index.d.ts +192 -10
- package/dist/esm/index.js +7112 -10
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +917 -1368
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +3 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +3 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js.map +1 -0
- package/dist/esm/solana/index.d.ts +17 -7
- package/dist/esm/solana/index.js +3706 -7
- package/dist/esm/solana/index.js.map +1 -0
- package/dist/esm/sui/index.d.ts +13 -4
- package/dist/esm/sui/index.js +1011 -4
- package/dist/esm/sui/index.js.map +1 -0
- package/package.json +57 -27
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +0 -111
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +0 -45
- package/dist/cjs/aptos/StreamClient.js +0 -226
- package/dist/cjs/aptos/constants.js +0 -27
- package/dist/cjs/aptos/index.js +0 -38
- package/dist/cjs/aptos/types.js +0 -69
- package/dist/cjs/aptos/utils.js +0 -34
- package/dist/cjs/aptos/wallet.js +0 -34
- package/dist/cjs/common/BaseStreamClient.js +0 -23
- package/dist/cjs/common/GenericStreamClient.js +0 -102
- package/dist/cjs/common/constants.js +0 -10
- package/dist/cjs/common/contractUtils.js +0 -77
- package/dist/cjs/common/types.js +0 -141
- package/dist/cjs/common/utils.js +0 -69
- package/dist/cjs/evm/StreamClient.js +0 -238
- package/dist/cjs/evm/abi.js +0 -1257
- package/dist/cjs/evm/constants.js +0 -38
- package/dist/cjs/evm/ercAbi.js +0 -224
- package/dist/cjs/evm/index.js +0 -40
- package/dist/cjs/evm/types.js +0 -66
- package/dist/cjs/evm/utils.js +0 -11
- package/dist/cjs/index.js +0 -43
- package/dist/cjs/solana/StreamClient.js +0 -1042
- package/dist/cjs/solana/constants.js +0 -95
- package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +0 -1437
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +0 -2
- package/dist/cjs/solana/index.js +0 -40
- package/dist/cjs/solana/instructionTypes.js +0 -2
- package/dist/cjs/solana/instructions.js +0 -298
- package/dist/cjs/solana/layout.js +0 -182
- package/dist/cjs/solana/lib/derive-accounts.js +0 -17
- package/dist/cjs/solana/lib/utils.js +0 -127
- package/dist/cjs/solana/timelockIDL.js +0 -422
- package/dist/cjs/solana/types.js +0 -93
- package/dist/cjs/sui/StreamClient.js +0 -416
- package/dist/cjs/sui/constants.js +0 -42
- package/dist/cjs/sui/index.js +0 -37
- package/dist/cjs/sui/types.js +0 -68
- package/dist/cjs/sui/utils.js +0 -46
- package/dist/cjs/sui/wallet.js +0 -40
- package/dist/esm/__tests__/aptos/streamClient.spec.d.ts +0 -1
- package/dist/esm/__tests__/aptos/streamClient.spec.js +0 -106
- package/dist/esm/__tests__/common/GenericStreamClient.spec.d.ts +0 -1
- package/dist/esm/__tests__/common/GenericStreamClient.spec.js +0 -40
- package/dist/esm/aptos/StreamClient.d.ts +0 -53
- package/dist/esm/aptos/StreamClient.js +0 -226
- package/dist/esm/aptos/constants.d.ts +0 -8
- package/dist/esm/aptos/constants.js +0 -24
- package/dist/esm/aptos/types.d.ts +0 -109
- package/dist/esm/aptos/types.js +0 -105
- package/dist/esm/aptos/utils.d.ts +0 -7
- package/dist/esm/aptos/utils.js +0 -30
- package/dist/esm/aptos/wallet.d.ts +0 -9
- package/dist/esm/aptos/wallet.js +0 -33
- package/dist/esm/common/BaseStreamClient.d.ts +0 -22
- package/dist/esm/common/BaseStreamClient.js +0 -19
- package/dist/esm/common/GenericStreamClient.d.ts +0 -72
- package/dist/esm/common/GenericStreamClient.js +0 -101
- package/dist/esm/common/constants.d.ts +0 -4
- package/dist/esm/common/constants.js +0 -4
- package/dist/esm/common/contractUtils.d.ts +0 -63
- package/dist/esm/common/contractUtils.js +0 -61
- package/dist/esm/common/types.d.ts +0 -353
- package/dist/esm/common/types.js +0 -135
- package/dist/esm/common/utils.d.ts +0 -32
- package/dist/esm/common/utils.js +0 -59
- package/dist/esm/evm/StreamClient.d.ts +0 -32
- package/dist/esm/evm/StreamClient.js +0 -237
- package/dist/esm/evm/abi.d.ts +0 -111
- package/dist/esm/evm/abi.js +0 -1255
- package/dist/esm/evm/constants.d.ts +0 -20
- package/dist/esm/evm/constants.js +0 -35
- package/dist/esm/evm/ercAbi.d.ts +0 -39
- package/dist/esm/evm/ercAbi.js +0 -222
- package/dist/esm/evm/types.d.ts +0 -98
- package/dist/esm/evm/types.js +0 -102
- package/dist/esm/evm/utils.d.ts +0 -1
- package/dist/esm/evm/utils.js +0 -8
- package/dist/esm/solana/StreamClient.d.ts +0 -150
- package/dist/esm/solana/StreamClient.js +0 -1017
- package/dist/esm/solana/constants.d.ts +0 -70
- package/dist/esm/solana/constants.js +0 -92
- package/dist/esm/solana/instructionTypes.d.ts +0 -101
- package/dist/esm/solana/instructionTypes.js +0 -1
- package/dist/esm/solana/instructions.d.ts +0 -142
- package/dist/esm/solana/instructions.js +0 -265
- package/dist/esm/solana/layout.d.ts +0 -27
- package/dist/esm/solana/layout.js +0 -155
- package/dist/esm/solana/lib/derive-accounts.d.ts +0 -4
- package/dist/esm/solana/lib/derive-accounts.js +0 -11
- package/dist/esm/solana/lib/utils.d.ts +0 -22
- package/dist/esm/solana/lib/utils.js +0 -117
- package/dist/esm/solana/timelockIDL.d.ts +0 -22
- package/dist/esm/solana/timelockIDL.js +0 -420
- package/dist/esm/solana/types.d.ts +0 -180
- package/dist/esm/solana/types.js +0 -142
- package/dist/esm/sui/StreamClient.d.ts +0 -82
- package/dist/esm/sui/StreamClient.js +0 -417
- package/dist/esm/sui/constants.d.ts +0 -10
- package/dist/esm/sui/constants.js +0 -39
- package/dist/esm/sui/types.d.ts +0 -167
- package/dist/esm/sui/types.js +0 -104
- package/dist/esm/sui/utils.d.ts +0 -11
- package/dist/esm/sui/utils.js +0 -39
- package/dist/esm/sui/wallet.d.ts +0 -17
- package/dist/esm/sui/wallet.js +0 -38
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { BN } from "bn.js";
|
|
2
|
-
import { describe, expect, test, beforeEach, vi } from "vitest";
|
|
3
|
-
import AptosStreamClient from "../../aptos/StreamClient.js";
|
|
4
|
-
import { ICluster } from "../../common/types.js";
|
|
5
|
-
describe("AptosStreamClient", () => {
|
|
6
|
-
describe("init", () => {
|
|
7
|
-
test("should successfully create AptosStreamInstance", () => {
|
|
8
|
-
const instance = new AptosStreamClient(ICluster.Devnet);
|
|
9
|
-
expect(instance).toBeInstanceOf(AptosStreamClient);
|
|
10
|
-
});
|
|
11
|
-
test("should correctly set passed params", () => {
|
|
12
|
-
const pid = "PID";
|
|
13
|
-
const gas = "30";
|
|
14
|
-
const instance = new AptosStreamClient("https://cluster", ICluster.Devnet, gas, pid);
|
|
15
|
-
expect(instance.getMaxGas()).toEqual({ max_gas_amount: gas });
|
|
16
|
-
expect(instance.getProgramId()).toBe(pid);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe("create", () => {
|
|
20
|
-
const pid = "PID";
|
|
21
|
-
const gas = "30";
|
|
22
|
-
let instance = new AptosStreamClient("https://cluster", ICluster.Devnet, gas, pid);
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
instance = new AptosStreamClient("https://cluster", ICluster.Devnet, gas, pid);
|
|
25
|
-
});
|
|
26
|
-
test("should create a stream with passed parameters", async () => {
|
|
27
|
-
// Arrange
|
|
28
|
-
const mockSigner = vi.fn();
|
|
29
|
-
const mockWallet = {
|
|
30
|
-
signAndSubmitTransaction: mockSigner,
|
|
31
|
-
account: { address: "" },
|
|
32
|
-
};
|
|
33
|
-
const mockRecipient = {
|
|
34
|
-
recipient: "0xtest",
|
|
35
|
-
amount: new BN(1000),
|
|
36
|
-
name: "test name",
|
|
37
|
-
cliffAmount: new BN(1),
|
|
38
|
-
amountPerPeriod: new BN(1),
|
|
39
|
-
};
|
|
40
|
-
const mockData = {
|
|
41
|
-
period: 100,
|
|
42
|
-
start: 10,
|
|
43
|
-
cliff: 12,
|
|
44
|
-
cancelableBySender: true,
|
|
45
|
-
cancelableByRecipient: false,
|
|
46
|
-
transferableBySender: false,
|
|
47
|
-
transferableByRecipient: true,
|
|
48
|
-
canTopup: true,
|
|
49
|
-
automaticWithdrawal: false,
|
|
50
|
-
withdrawalFrequency: 10,
|
|
51
|
-
tokenId: "0xtest::token::Token",
|
|
52
|
-
canPause: false,
|
|
53
|
-
canUpdateRate: false,
|
|
54
|
-
};
|
|
55
|
-
const mockReturn = "hash";
|
|
56
|
-
mockSigner.mockResolvedValue({ hash: mockReturn });
|
|
57
|
-
// Act
|
|
58
|
-
const result = await instance.create({
|
|
59
|
-
...mockData,
|
|
60
|
-
...mockRecipient,
|
|
61
|
-
}, { senderWallet: mockWallet });
|
|
62
|
-
// Assert
|
|
63
|
-
expect(mockSigner).toHaveBeenCalledTimes(1);
|
|
64
|
-
const callParam = mockSigner.mock.calls[0][0];
|
|
65
|
-
const args = callParam.arguments;
|
|
66
|
-
delete callParam.arguments;
|
|
67
|
-
args.shift();
|
|
68
|
-
expect(args).toEqual([
|
|
69
|
-
mockRecipient.amount.toString(),
|
|
70
|
-
100,
|
|
71
|
-
mockRecipient.amountPerPeriod.toString(),
|
|
72
|
-
10,
|
|
73
|
-
mockRecipient.cliffAmount.toString(),
|
|
74
|
-
true,
|
|
75
|
-
false,
|
|
76
|
-
false,
|
|
77
|
-
true,
|
|
78
|
-
true,
|
|
79
|
-
false,
|
|
80
|
-
false,
|
|
81
|
-
false,
|
|
82
|
-
10,
|
|
83
|
-
"test name",
|
|
84
|
-
"0xtest",
|
|
85
|
-
]);
|
|
86
|
-
expect(callParam).toEqual({
|
|
87
|
-
function: "PID::protocol::create",
|
|
88
|
-
type: "create",
|
|
89
|
-
type_arguments: ["0xtest::token::Token"],
|
|
90
|
-
});
|
|
91
|
-
expect(result.txId).toEqual(mockReturn);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
// describe("createMultiple", () => {
|
|
95
|
-
// });
|
|
96
|
-
// describe("withdraw", () => {
|
|
97
|
-
// });
|
|
98
|
-
// describe("cancel", () => {
|
|
99
|
-
// });
|
|
100
|
-
// describe("transfer", () => {
|
|
101
|
-
// });
|
|
102
|
-
// describe("topup", () => {
|
|
103
|
-
// });
|
|
104
|
-
// describe("getOne", () => {
|
|
105
|
-
// });
|
|
106
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Wallet } from "ethers";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { StreamflowAptos, StreamflowEVM, StreamflowSolana, StreamflowSui } from "../../index.js";
|
|
4
|
-
import { default as GenericStreamClient } from "../../common/GenericStreamClient.js";
|
|
5
|
-
import { IChain, ICluster, } from "../../common/types.js";
|
|
6
|
-
describe("GenericStreamClient", () => {
|
|
7
|
-
describe.each([
|
|
8
|
-
{
|
|
9
|
-
chain: IChain.Aptos,
|
|
10
|
-
cluster: ICluster.Devnet,
|
|
11
|
-
clusterUrl: "https://cluster",
|
|
12
|
-
expected: StreamflowAptos.AptosStreamClient,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
chain: IChain.Solana,
|
|
16
|
-
cluster: ICluster.Devnet,
|
|
17
|
-
clusterUrl: "https://cluster",
|
|
18
|
-
expected: StreamflowSolana.SolanaStreamClient,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
chain: IChain.Ethereum,
|
|
22
|
-
cluster: ICluster.Devnet,
|
|
23
|
-
clusterUrl: "https://cluster",
|
|
24
|
-
signer: Wallet.createRandom(),
|
|
25
|
-
expected: StreamflowEVM.EvmStreamClient,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
chain: IChain.Sui,
|
|
29
|
-
cluster: ICluster.Devnet,
|
|
30
|
-
clusterUrl: "https://cluster",
|
|
31
|
-
expected: StreamflowSui.SuiStreamClient,
|
|
32
|
-
},
|
|
33
|
-
])(".init($chain)", (config) => {
|
|
34
|
-
test("should successfully create GenericStreamClient instance", () => {
|
|
35
|
-
const instance = new GenericStreamClient(config);
|
|
36
|
-
expect(instance).toBeInstanceOf(GenericStreamClient);
|
|
37
|
-
expect(instance.nativeStreamClient).toBeInstanceOf(config.expected);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { BaseStreamClient } from "../common/BaseStreamClient.js";
|
|
2
|
-
import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetFeesData, IGetOneData, IFees, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData } from "../common/types.js";
|
|
3
|
-
import { Contract, ICreateStreamAptosExt, ITransactionAptosExt } from "./types.js";
|
|
4
|
-
export default class AptosStreamClient extends BaseStreamClient {
|
|
5
|
-
private programId;
|
|
6
|
-
private maxGas;
|
|
7
|
-
private client;
|
|
8
|
-
constructor(clusterUrl: string, cluster?: ICluster, maxGas?: string, programId?: string);
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new stream/vesting contract.
|
|
11
|
-
*/
|
|
12
|
-
create(streamData: ICreateStreamData, { senderWallet }: ICreateStreamAptosExt): Promise<ICreateResult>;
|
|
13
|
-
/**
|
|
14
|
-
* Creates multiple stream/vesting contracts.
|
|
15
|
-
*/
|
|
16
|
-
createMultiple(multipleStreamData: ICreateMultipleStreamData, { senderWallet }: ICreateStreamAptosExt): Promise<IMultiTransactionResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Attempts withdrawing from the specified stream.
|
|
19
|
-
*/
|
|
20
|
-
withdraw({ id, amount }: IWithdrawData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
21
|
-
/**
|
|
22
|
-
* Attempts canceling the specified stream.
|
|
23
|
-
*/
|
|
24
|
-
cancel(cancelData: ICancelData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
27
|
-
*/
|
|
28
|
-
transfer(transferData: ITransferData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
29
|
-
/**
|
|
30
|
-
* Tops up stream account with specified amount.
|
|
31
|
-
*/
|
|
32
|
-
topup(topupData: ITopUpData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
33
|
-
/**
|
|
34
|
-
* Fetch stream data by its id (address).
|
|
35
|
-
*/
|
|
36
|
-
getOne({ id }: IGetOneData): Promise<Contract>;
|
|
37
|
-
get(): Promise<[string, Contract][]>;
|
|
38
|
-
/**
|
|
39
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
40
|
-
*/
|
|
41
|
-
update(updateData: IUpdateData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
42
|
-
getFees({ address }: IGetFeesData): Promise<IFees | null>;
|
|
43
|
-
getDefaultStreamflowFee(): Promise<number>;
|
|
44
|
-
extractErrorCode(err: Error): string | null;
|
|
45
|
-
/**
|
|
46
|
-
* Returns StreamClient protocol program ID.
|
|
47
|
-
*/
|
|
48
|
-
getProgramId(): string;
|
|
49
|
-
getMaxGas(): {
|
|
50
|
-
max_gas_amount: string;
|
|
51
|
-
};
|
|
52
|
-
private generateMultiPayloads;
|
|
53
|
-
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { AptosAccount, AptosClient } from "aptos";
|
|
2
|
-
import { BaseStreamClient } from "../common/BaseStreamClient.js";
|
|
3
|
-
import { ICluster, } from "../common/types.js";
|
|
4
|
-
import { APTOS_PROGRAM_IDS } from "./constants.js";
|
|
5
|
-
import { Contract, } from "./types.js";
|
|
6
|
-
import { AptosWalletWrapper } from "./wallet.js";
|
|
7
|
-
import { extractAptosErrorCode } from "./utils.js";
|
|
8
|
-
import { WITHDRAW_AVAILABLE_AMOUNT } from "../common/constants.js";
|
|
9
|
-
export default class AptosStreamClient extends BaseStreamClient {
|
|
10
|
-
programId;
|
|
11
|
-
maxGas;
|
|
12
|
-
client;
|
|
13
|
-
constructor(clusterUrl, cluster = ICluster.Mainnet, maxGas = "10000", programId) {
|
|
14
|
-
super();
|
|
15
|
-
this.programId = programId ? programId : APTOS_PROGRAM_IDS[cluster];
|
|
16
|
-
this.maxGas = maxGas;
|
|
17
|
-
this.client = new AptosClient(clusterUrl);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new stream/vesting contract.
|
|
21
|
-
*/
|
|
22
|
-
async create(streamData, { senderWallet }) {
|
|
23
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
24
|
-
const [metadataId, payload] = this.generateMultiPayloads({
|
|
25
|
-
...streamData,
|
|
26
|
-
recipients: [{ ...streamData }],
|
|
27
|
-
}, wallet)[0];
|
|
28
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
29
|
-
return { ixs: [payload], txId: hash, metadataId };
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Creates multiple stream/vesting contracts.
|
|
33
|
-
*/
|
|
34
|
-
async createMultiple(multipleStreamData, { senderWallet }) {
|
|
35
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
36
|
-
const payloads = this.generateMultiPayloads(multipleStreamData, wallet);
|
|
37
|
-
const txs = [];
|
|
38
|
-
const metadatas = [];
|
|
39
|
-
const metadataToRecipient = {};
|
|
40
|
-
const errors = [];
|
|
41
|
-
for (let i = 0; i < payloads.length; i++) {
|
|
42
|
-
const [metadataId, payload] = payloads[i];
|
|
43
|
-
const recipient = multipleStreamData.recipients[i];
|
|
44
|
-
try {
|
|
45
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
46
|
-
txs.push(hash);
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
errors.push({
|
|
50
|
-
error: e?.toString() ?? "Unknown error!",
|
|
51
|
-
recipient: recipient.recipient,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
finally {
|
|
55
|
-
metadatas.push(metadataId);
|
|
56
|
-
metadataToRecipient[metadataId] = recipient;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
txs,
|
|
61
|
-
metadatas,
|
|
62
|
-
metadataToRecipient,
|
|
63
|
-
errors,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Attempts withdrawing from the specified stream.
|
|
68
|
-
*/
|
|
69
|
-
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { senderWallet, tokenId }) {
|
|
70
|
-
const payload = {
|
|
71
|
-
type: "withdraw",
|
|
72
|
-
function: `${this.programId}::protocol::withdraw`,
|
|
73
|
-
type_arguments: [tokenId],
|
|
74
|
-
arguments: [id, amount.toString()],
|
|
75
|
-
};
|
|
76
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
77
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
78
|
-
return { ixs: [payload], txId: hash };
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Attempts canceling the specified stream.
|
|
82
|
-
*/
|
|
83
|
-
async cancel(cancelData, { senderWallet, tokenId }) {
|
|
84
|
-
const payload = {
|
|
85
|
-
type: "cancel",
|
|
86
|
-
function: `${this.programId}::protocol::cancel`,
|
|
87
|
-
type_arguments: [tokenId],
|
|
88
|
-
arguments: [cancelData.id],
|
|
89
|
-
};
|
|
90
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
91
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
92
|
-
return { ixs: [payload], txId: hash };
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
96
|
-
*/
|
|
97
|
-
async transfer(transferData, { senderWallet, tokenId }) {
|
|
98
|
-
const payload = {
|
|
99
|
-
type: "transfer",
|
|
100
|
-
function: `${this.programId}::protocol::transfer`,
|
|
101
|
-
type_arguments: [tokenId],
|
|
102
|
-
arguments: [transferData.id, transferData.newRecipient],
|
|
103
|
-
};
|
|
104
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
105
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
106
|
-
return { ixs: [payload], txId: hash };
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Tops up stream account with specified amount.
|
|
110
|
-
*/
|
|
111
|
-
async topup(topupData, { senderWallet, tokenId }) {
|
|
112
|
-
const payload = {
|
|
113
|
-
type: "topup",
|
|
114
|
-
function: `${this.programId}::protocol::topup`,
|
|
115
|
-
type_arguments: [tokenId],
|
|
116
|
-
arguments: [topupData.id, topupData.amount.toString()],
|
|
117
|
-
};
|
|
118
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
119
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
120
|
-
return { ixs: [payload], txId: hash };
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Fetch stream data by its id (address).
|
|
124
|
-
*/
|
|
125
|
-
async getOne({ id }) {
|
|
126
|
-
const contractResources = await this.client.getAccountResources(id);
|
|
127
|
-
const contract = contractResources.find((r) => r.type.includes("protocol::Contract"));
|
|
128
|
-
if (!contract) {
|
|
129
|
-
throw new Error(`Contract with id ${id} could not be found!`);
|
|
130
|
-
}
|
|
131
|
-
const tokenIdMatch = contract.type.match(/0x[0-9a-f]+::protocol::Contract<(.*)>/);
|
|
132
|
-
const tokenId = tokenIdMatch?.[1] ?? "";
|
|
133
|
-
const { data } = contract;
|
|
134
|
-
return new Contract(data, tokenId);
|
|
135
|
-
}
|
|
136
|
-
async get() {
|
|
137
|
-
throw new Error("Get all method is not supported for Aptos chain!");
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
141
|
-
*/
|
|
142
|
-
async update(updateData, { senderWallet, tokenId }) {
|
|
143
|
-
const wallet = new AptosWalletWrapper(senderWallet, this.client);
|
|
144
|
-
const payload = {
|
|
145
|
-
type: "update",
|
|
146
|
-
function: `${this.programId}::protocol::update`,
|
|
147
|
-
type_arguments: [tokenId],
|
|
148
|
-
arguments: [
|
|
149
|
-
updateData.id,
|
|
150
|
-
updateData.enableAutomaticWithdrawal ? [true] : [],
|
|
151
|
-
updateData.withdrawFrequency ? [updateData.withdrawFrequency.toString()] : [],
|
|
152
|
-
updateData.amountPerPeriod ? [updateData.amountPerPeriod.toString()] : [],
|
|
153
|
-
],
|
|
154
|
-
};
|
|
155
|
-
const hash = await wallet.signAndSubmitTransaction(payload);
|
|
156
|
-
return { ixs: [payload], txId: hash };
|
|
157
|
-
}
|
|
158
|
-
async getFees({ address }) {
|
|
159
|
-
const resource = await this.client.getAccountResource(this.programId, `${this.programId}::fees::FeeTable`);
|
|
160
|
-
const data = resource.data;
|
|
161
|
-
const value = await this.client.getTableItem(data.values.handle, {
|
|
162
|
-
key_type: "address",
|
|
163
|
-
key: address,
|
|
164
|
-
value_type: "u64",
|
|
165
|
-
});
|
|
166
|
-
if (!value) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
return { streamflowFee: Number(value) / 100, partnerFee: 0 };
|
|
170
|
-
}
|
|
171
|
-
async getDefaultStreamflowFee() {
|
|
172
|
-
const resource = await this.client.getAccountResource(this.programId, `${this.programId}::admin::ConfigV2`);
|
|
173
|
-
return Number(resource.data.streamflow_fees) / 100;
|
|
174
|
-
}
|
|
175
|
-
extractErrorCode(err) {
|
|
176
|
-
return extractAptosErrorCode(err.toString() ?? "Unknown error!");
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Returns StreamClient protocol program ID.
|
|
180
|
-
*/
|
|
181
|
-
getProgramId() {
|
|
182
|
-
return this.programId;
|
|
183
|
-
}
|
|
184
|
-
getMaxGas() {
|
|
185
|
-
return { max_gas_amount: this.maxGas };
|
|
186
|
-
}
|
|
187
|
-
// Utility function to prepare transaction payloads for multiple recipients.
|
|
188
|
-
generateMultiPayloads(multipleStreamData, wallet) {
|
|
189
|
-
return multipleStreamData.recipients.map((recipient) => {
|
|
190
|
-
const acc = new AptosAccount(); // Generate random address as seeds for deriving "escrow" account
|
|
191
|
-
const seeds = acc.address();
|
|
192
|
-
const encoder = new TextEncoder();
|
|
193
|
-
// A workaround to pass a String in seeds because different wallets seem
|
|
194
|
-
// to serialize vector<u8> differently and String should be safer that Uin8Array
|
|
195
|
-
const actualSeeds = encoder.encode(seeds.hex());
|
|
196
|
-
const metadataId = AptosAccount.getResourceAccountAddress(wallet.address, actualSeeds);
|
|
197
|
-
return [
|
|
198
|
-
metadataId.toString(),
|
|
199
|
-
{
|
|
200
|
-
type: "create",
|
|
201
|
-
function: `${this.programId}::protocol::create`,
|
|
202
|
-
type_arguments: [multipleStreamData.tokenId],
|
|
203
|
-
arguments: [
|
|
204
|
-
seeds.hex(),
|
|
205
|
-
recipient.amount.toString(),
|
|
206
|
-
multipleStreamData.period,
|
|
207
|
-
recipient.amountPerPeriod.toString(),
|
|
208
|
-
multipleStreamData.start,
|
|
209
|
-
recipient.cliffAmount.toString(),
|
|
210
|
-
multipleStreamData.cancelableBySender,
|
|
211
|
-
multipleStreamData.cancelableByRecipient,
|
|
212
|
-
multipleStreamData.transferableBySender,
|
|
213
|
-
multipleStreamData.transferableByRecipient,
|
|
214
|
-
multipleStreamData.canTopup,
|
|
215
|
-
multipleStreamData.canPause || false,
|
|
216
|
-
multipleStreamData.canUpdateRate || false,
|
|
217
|
-
multipleStreamData.automaticWithdrawal || false,
|
|
218
|
-
multipleStreamData.withdrawalFrequency || 0,
|
|
219
|
-
recipient.name,
|
|
220
|
-
recipient.recipient,
|
|
221
|
-
],
|
|
222
|
-
},
|
|
223
|
-
];
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ICluster } from "../common/types.js";
|
|
2
|
-
export declare const APTOS_PROGRAM_IDS: Record<ICluster, string>;
|
|
3
|
-
export declare const APTOS_ERROR_MATCH_REGEX: RegExp;
|
|
4
|
-
export declare const APTOS_MODULE_ERROR_MAP: {
|
|
5
|
-
[key: string]: {
|
|
6
|
-
[key: number]: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ContractErrorCode, ICluster } from "../common/types.js";
|
|
2
|
-
export const APTOS_PROGRAM_IDS = {
|
|
3
|
-
[ICluster.Mainnet]: "0x9009d93d52576bf9ac6dc6cf10b870610bcb316342fef6eff80662fbbfce51b0",
|
|
4
|
-
// TODO: Add a correct programID for Test net
|
|
5
|
-
[ICluster.Devnet]: "0xc6737de143d91b2f99a7e490d4f8348fdfa3bdd1eb8737a27d0455f8a3625688",
|
|
6
|
-
[ICluster.Testnet]: "0xc6737de143d91b2f99a7e490d4f8348fdfa3bdd1eb8737a27d0455f8a3625688",
|
|
7
|
-
[ICluster.Local]: "0x9009d93d52576bf9ac6dc6cf10b870610bcb316342fef6eff80662fbbfce51b0",
|
|
8
|
-
};
|
|
9
|
-
export const APTOS_ERROR_MATCH_REGEX = /Move abort in [a-z0-9]+::([^:]+): ([A-Z_]+)/;
|
|
10
|
-
export const APTOS_MODULE_ERROR_MAP = {
|
|
11
|
-
protocol: {
|
|
12
|
-
1: ContractErrorCode.ECONTRACT_NOT_INIT,
|
|
13
|
-
2: ContractErrorCode.EBAD_AMOUNT,
|
|
14
|
-
3: ContractErrorCode.ENO_PERMISSIONS,
|
|
15
|
-
4: ContractErrorCode.EBADINPUT,
|
|
16
|
-
5: ContractErrorCode.ECLOSED,
|
|
17
|
-
6: ContractErrorCode.EBAD_INPUT_AMOUNT_PER_PERIOD,
|
|
18
|
-
8: ContractErrorCode.EBAD_INPUT_UPDATE_RATE,
|
|
19
|
-
9: ContractErrorCode.EBAD_INPUT_CLIFF_AMOUNT,
|
|
20
|
-
10: ContractErrorCode.EBAD_INPUT_PERIOD,
|
|
21
|
-
11: ContractErrorCode.EBAD_INPUT_START,
|
|
22
|
-
12: ContractErrorCode.ENO_RECIPIENT_COIN_ADDRESS,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { AptosAccount } from "aptos";
|
|
2
|
-
import { WalletContextState } from "@manahippo/aptos-wallet-adapter";
|
|
3
|
-
import BN from "bn.js";
|
|
4
|
-
import { LinearStream, StreamType } from "../common/types.js";
|
|
5
|
-
export interface ICreateStreamAptosExt {
|
|
6
|
-
senderWallet: WalletContextState | AptosAccount;
|
|
7
|
-
}
|
|
8
|
-
export type ITransactionAptosExt = ICreateStreamAptosExt & {
|
|
9
|
-
tokenId: string;
|
|
10
|
-
};
|
|
11
|
-
export interface StreamResource {
|
|
12
|
-
amount: string;
|
|
13
|
-
amount_per_period: string;
|
|
14
|
-
canceled_at: string;
|
|
15
|
-
cliff_amount: string;
|
|
16
|
-
closed: boolean;
|
|
17
|
-
contract_signer_cap: {
|
|
18
|
-
account: string;
|
|
19
|
-
};
|
|
20
|
-
created: string;
|
|
21
|
-
current_pause_start: string;
|
|
22
|
-
end: string;
|
|
23
|
-
fees: {
|
|
24
|
-
streamflow_fee: string;
|
|
25
|
-
streamflow_fee_percentage: string;
|
|
26
|
-
streamflow_fee_withdrawn: string;
|
|
27
|
-
};
|
|
28
|
-
funds_unlocked_at_last_rate_change: string;
|
|
29
|
-
last_rate_change_time: string;
|
|
30
|
-
last_withdrawn_at: string;
|
|
31
|
-
meta: {
|
|
32
|
-
automatic_withdrawal: boolean;
|
|
33
|
-
can_topup: boolean;
|
|
34
|
-
can_update_rate: boolean;
|
|
35
|
-
cancelable_by_recipient: boolean;
|
|
36
|
-
cancelable_by_sender: boolean;
|
|
37
|
-
contract_name: string;
|
|
38
|
-
pausable: boolean;
|
|
39
|
-
transferable_by_recipient: boolean;
|
|
40
|
-
transferable_by_sender: boolean;
|
|
41
|
-
withdrawal_frequency: string;
|
|
42
|
-
};
|
|
43
|
-
pause_cumulative: string;
|
|
44
|
-
period: string;
|
|
45
|
-
recipient: string;
|
|
46
|
-
sender: string;
|
|
47
|
-
start: string;
|
|
48
|
-
withdrawn: string;
|
|
49
|
-
}
|
|
50
|
-
export interface FeeTableResource {
|
|
51
|
-
values: {
|
|
52
|
-
handle: string;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export interface ConfigResource {
|
|
56
|
-
admin: string;
|
|
57
|
-
streamflow_fees: string;
|
|
58
|
-
treasury: string;
|
|
59
|
-
tx_fee: string;
|
|
60
|
-
withdrawor: string;
|
|
61
|
-
}
|
|
62
|
-
export declare class Contract implements LinearStream {
|
|
63
|
-
magic: number;
|
|
64
|
-
version: number;
|
|
65
|
-
createdAt: number;
|
|
66
|
-
withdrawnAmount: BN;
|
|
67
|
-
canceledAt: number;
|
|
68
|
-
end: number;
|
|
69
|
-
lastWithdrawnAt: number;
|
|
70
|
-
sender: string;
|
|
71
|
-
senderTokens: string;
|
|
72
|
-
recipient: string;
|
|
73
|
-
recipientTokens: string;
|
|
74
|
-
mint: string;
|
|
75
|
-
escrowTokens: string;
|
|
76
|
-
streamflowTreasury: string;
|
|
77
|
-
streamflowTreasuryTokens: string;
|
|
78
|
-
streamflowFeeTotal: BN;
|
|
79
|
-
streamflowFeeWithdrawn: BN;
|
|
80
|
-
streamflowFeePercent: number;
|
|
81
|
-
partnerFeeTotal: BN;
|
|
82
|
-
partnerFeeWithdrawn: BN;
|
|
83
|
-
partnerFeePercent: number;
|
|
84
|
-
partner: string;
|
|
85
|
-
partnerTokens: string;
|
|
86
|
-
start: number;
|
|
87
|
-
depositedAmount: BN;
|
|
88
|
-
period: number;
|
|
89
|
-
amountPerPeriod: BN;
|
|
90
|
-
cliff: number;
|
|
91
|
-
cliffAmount: BN;
|
|
92
|
-
cancelableBySender: boolean;
|
|
93
|
-
cancelableByRecipient: boolean;
|
|
94
|
-
automaticWithdrawal: boolean;
|
|
95
|
-
transferableBySender: boolean;
|
|
96
|
-
transferableByRecipient: boolean;
|
|
97
|
-
canTopup: boolean;
|
|
98
|
-
name: string;
|
|
99
|
-
withdrawalFrequency: number;
|
|
100
|
-
closed: boolean;
|
|
101
|
-
currentPauseStart: number;
|
|
102
|
-
pauseCumulative: BN;
|
|
103
|
-
lastRateChangeTime: number;
|
|
104
|
-
fundsUnlockedAtLastRateChange: BN;
|
|
105
|
-
type: StreamType;
|
|
106
|
-
constructor(stream: StreamResource, tokenId: string);
|
|
107
|
-
unlocked(currentTimestamp: number): BN;
|
|
108
|
-
remaining(decimals: number): number;
|
|
109
|
-
}
|
package/dist/esm/aptos/types.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
|
-
import { Buffer } from "buffer";
|
|
3
|
-
import { buildStreamType, calculateUnlockedAmount } from "../common/contractUtils.js";
|
|
4
|
-
import { normalizeAptosAddress } from "./utils.js";
|
|
5
|
-
import { getNumberFromBN } from "../common/utils.js";
|
|
6
|
-
export class Contract {
|
|
7
|
-
magic;
|
|
8
|
-
version;
|
|
9
|
-
createdAt;
|
|
10
|
-
withdrawnAmount;
|
|
11
|
-
canceledAt;
|
|
12
|
-
end;
|
|
13
|
-
lastWithdrawnAt;
|
|
14
|
-
sender;
|
|
15
|
-
senderTokens;
|
|
16
|
-
recipient;
|
|
17
|
-
recipientTokens;
|
|
18
|
-
mint;
|
|
19
|
-
escrowTokens;
|
|
20
|
-
streamflowTreasury;
|
|
21
|
-
streamflowTreasuryTokens;
|
|
22
|
-
streamflowFeeTotal;
|
|
23
|
-
streamflowFeeWithdrawn;
|
|
24
|
-
streamflowFeePercent;
|
|
25
|
-
partnerFeeTotal;
|
|
26
|
-
partnerFeeWithdrawn;
|
|
27
|
-
partnerFeePercent;
|
|
28
|
-
partner;
|
|
29
|
-
partnerTokens;
|
|
30
|
-
start;
|
|
31
|
-
depositedAmount;
|
|
32
|
-
period;
|
|
33
|
-
amountPerPeriod;
|
|
34
|
-
cliff;
|
|
35
|
-
cliffAmount;
|
|
36
|
-
cancelableBySender;
|
|
37
|
-
cancelableByRecipient;
|
|
38
|
-
automaticWithdrawal;
|
|
39
|
-
transferableBySender;
|
|
40
|
-
transferableByRecipient;
|
|
41
|
-
canTopup;
|
|
42
|
-
name;
|
|
43
|
-
withdrawalFrequency;
|
|
44
|
-
closed;
|
|
45
|
-
currentPauseStart;
|
|
46
|
-
pauseCumulative;
|
|
47
|
-
lastRateChangeTime;
|
|
48
|
-
fundsUnlockedAtLastRateChange;
|
|
49
|
-
type;
|
|
50
|
-
constructor(stream, tokenId) {
|
|
51
|
-
this.magic = 0;
|
|
52
|
-
this.version = 0;
|
|
53
|
-
this.createdAt = parseInt(stream.created);
|
|
54
|
-
this.withdrawnAmount = new BN(stream.withdrawn);
|
|
55
|
-
this.canceledAt = parseInt(stream.canceled_at);
|
|
56
|
-
this.end = parseInt(stream.end);
|
|
57
|
-
this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
|
|
58
|
-
this.sender = normalizeAptosAddress(stream.sender);
|
|
59
|
-
this.senderTokens = normalizeAptosAddress(stream.sender);
|
|
60
|
-
this.recipient = normalizeAptosAddress(stream.recipient);
|
|
61
|
-
this.recipientTokens = normalizeAptosAddress(stream.recipient);
|
|
62
|
-
this.mint = tokenId;
|
|
63
|
-
this.escrowTokens = "";
|
|
64
|
-
this.streamflowTreasury = "";
|
|
65
|
-
this.streamflowTreasuryTokens = "";
|
|
66
|
-
this.streamflowFeeTotal = new BN(0);
|
|
67
|
-
this.streamflowFeeWithdrawn = new BN(0);
|
|
68
|
-
this.streamflowFeePercent = parseInt(stream.fees.streamflow_fee_percentage) / 10000;
|
|
69
|
-
this.partnerFeeTotal = new BN(0);
|
|
70
|
-
this.partnerFeeWithdrawn = new BN(0);
|
|
71
|
-
this.partnerFeePercent = 0;
|
|
72
|
-
this.partner = "";
|
|
73
|
-
this.partnerTokens = "";
|
|
74
|
-
this.start = parseInt(stream.start);
|
|
75
|
-
this.depositedAmount = new BN(stream.amount);
|
|
76
|
-
this.period = parseInt(stream.period);
|
|
77
|
-
this.amountPerPeriod = new BN(stream.amount_per_period);
|
|
78
|
-
this.cliff = parseInt(stream.start);
|
|
79
|
-
this.cliffAmount = new BN(stream.cliff_amount);
|
|
80
|
-
this.cancelableBySender = stream.meta.cancelable_by_sender;
|
|
81
|
-
this.cancelableByRecipient = stream.meta.cancelable_by_recipient;
|
|
82
|
-
this.automaticWithdrawal = stream.meta.automatic_withdrawal;
|
|
83
|
-
this.transferableBySender = stream.meta.transferable_by_sender;
|
|
84
|
-
this.transferableByRecipient = stream.meta.transferable_by_recipient;
|
|
85
|
-
this.canTopup = stream.meta.can_topup;
|
|
86
|
-
const name = stream.meta.contract_name.replace("0x", "");
|
|
87
|
-
this.name = Buffer.from(name, "hex").toString("utf8");
|
|
88
|
-
this.withdrawalFrequency = parseInt(stream.meta.withdrawal_frequency);
|
|
89
|
-
this.closed = stream.closed;
|
|
90
|
-
this.currentPauseStart = parseInt(stream.current_pause_start);
|
|
91
|
-
this.pauseCumulative = new BN(stream.pause_cumulative);
|
|
92
|
-
this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
|
|
93
|
-
this.fundsUnlockedAtLastRateChange = new BN(stream.funds_unlocked_at_last_rate_change);
|
|
94
|
-
this.type = buildStreamType(this);
|
|
95
|
-
}
|
|
96
|
-
unlocked(currentTimestamp) {
|
|
97
|
-
return calculateUnlockedAmount({
|
|
98
|
-
...this,
|
|
99
|
-
currentTimestamp,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
remaining(decimals) {
|
|
103
|
-
return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function extractAptosErrorCode(errorText: string): string | null;
|
|
2
|
-
/**
|
|
3
|
-
* Aptos has inconsistencies in how it returns addresses.
|
|
4
|
-
* This method normalizes them to be 64+2(0x...) characters long, or leaves it as SPECIAL ADDRESS (0x0 - 0xf inclusive)
|
|
5
|
-
* Per this: https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/core/accountAddress.ts#L115
|
|
6
|
-
* */
|
|
7
|
-
export declare function normalizeAptosAddress(address: string): string;
|