@superfluid-finance/sdk-core 1.0.1-dev.c4f51ea.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.
Files changed (120) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +487 -0
  3. package/dist/main/BatchCall.d.ts +53 -0
  4. package/dist/main/ConstantFlowAgreementV1.d.ts +74 -0
  5. package/dist/main/Framework.d.ts +75 -0
  6. package/dist/main/Host.d.ts +18 -0
  7. package/dist/main/InstantDistributionAgreementV1.d.ts +107 -0
  8. package/dist/main/Operation.d.ts +38 -0
  9. package/dist/main/Query.d.ts +24 -0
  10. package/dist/main/SFError.d.ts +13 -0
  11. package/dist/main/SuperToken.d.ts +191 -0
  12. package/dist/main/Token.d.ts +76 -0
  13. package/dist/main/constants.d.ts +10 -0
  14. package/dist/main/events.d.ts +254 -0
  15. package/dist/main/frameworkHelpers.d.ts +20 -0
  16. package/dist/main/index.d.ts +19 -0
  17. package/dist/main/index.js +10780 -0
  18. package/dist/main/interfaces.d.ts +309 -0
  19. package/dist/main/mapGetAllEventsQueryEvents.d.ts +3 -0
  20. package/dist/main/pagination.d.ts +31 -0
  21. package/dist/main/scripts/setup.d.ts +22 -0
  22. package/dist/main/subgraph/SubgraphClient.d.ts +16 -0
  23. package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +41 -0
  24. package/dist/main/subgraph/queries/getAllEvents.generated.d.ts +578 -0
  25. package/dist/main/subgraph/queries/getIndexSubscriptions.generated.d.ts +42 -0
  26. package/dist/main/subgraph/queries/getIndexes.generated.d.ts +40 -0
  27. package/dist/main/subgraph/queries/getStreams.generated.d.ts +54 -0
  28. package/dist/main/subgraph/queries/getTokens.generated.d.ts +23 -0
  29. package/dist/main/subgraph/schema.generated.d.ts +6907 -0
  30. package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.d.ts +35 -0
  31. package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +35 -0
  32. package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +35 -0
  33. package/dist/main/typechain/factories/IResolver__factory.d.ts +22 -0
  34. package/dist/main/typechain/factories/SuperToken__factory.d.ts +46 -0
  35. package/dist/main/typechain/factories/SuperfluidLoader__factory.d.ts +37 -0
  36. package/dist/main/typechain/factories/Superfluid__factory.d.ts +82 -0
  37. package/dist/main/typechain/factories/TestToken__factory.d.ts +46 -0
  38. package/dist/main/typechain/index.d.ts +16 -0
  39. package/dist/main/types.d.ts +2 -0
  40. package/dist/main/utils.d.ts +89 -0
  41. package/dist/main/validation.d.ts +8 -0
  42. package/dist/module/BatchCall.d.ts +53 -0
  43. package/dist/module/ConstantFlowAgreementV1.d.ts +74 -0
  44. package/dist/module/Framework.d.ts +75 -0
  45. package/dist/module/Host.d.ts +18 -0
  46. package/dist/module/InstantDistributionAgreementV1.d.ts +107 -0
  47. package/dist/module/Operation.d.ts +38 -0
  48. package/dist/module/Query.d.ts +24 -0
  49. package/dist/module/SFError.d.ts +13 -0
  50. package/dist/module/SuperToken.d.ts +191 -0
  51. package/dist/module/Token.d.ts +76 -0
  52. package/dist/module/constants.d.ts +10 -0
  53. package/dist/module/events.d.ts +254 -0
  54. package/dist/module/frameworkHelpers.d.ts +20 -0
  55. package/dist/module/index.d.ts +19 -0
  56. package/dist/module/index.js +10749 -0
  57. package/dist/module/interfaces.d.ts +309 -0
  58. package/dist/module/mapGetAllEventsQueryEvents.d.ts +3 -0
  59. package/dist/module/pagination.d.ts +31 -0
  60. package/dist/module/scripts/setup.d.ts +22 -0
  61. package/dist/module/subgraph/SubgraphClient.d.ts +16 -0
  62. package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +41 -0
  63. package/dist/module/subgraph/queries/getAllEvents.generated.d.ts +578 -0
  64. package/dist/module/subgraph/queries/getIndexSubscriptions.generated.d.ts +42 -0
  65. package/dist/module/subgraph/queries/getIndexes.generated.d.ts +40 -0
  66. package/dist/module/subgraph/queries/getStreams.generated.d.ts +54 -0
  67. package/dist/module/subgraph/queries/getTokens.generated.d.ts +23 -0
  68. package/dist/module/subgraph/schema.generated.d.ts +6907 -0
  69. package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.d.ts +35 -0
  70. package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +35 -0
  71. package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +35 -0
  72. package/dist/module/typechain/factories/IResolver__factory.d.ts +22 -0
  73. package/dist/module/typechain/factories/SuperToken__factory.d.ts +46 -0
  74. package/dist/module/typechain/factories/SuperfluidLoader__factory.d.ts +37 -0
  75. package/dist/module/typechain/factories/Superfluid__factory.d.ts +82 -0
  76. package/dist/module/typechain/factories/TestToken__factory.d.ts +46 -0
  77. package/dist/module/typechain/index.d.ts +16 -0
  78. package/dist/module/types.d.ts +2 -0
  79. package/dist/module/utils.d.ts +89 -0
  80. package/dist/module/validation.d.ts +8 -0
  81. package/dist/umd/BatchCall.d.ts +53 -0
  82. package/dist/umd/ConstantFlowAgreementV1.d.ts +74 -0
  83. package/dist/umd/Framework.d.ts +75 -0
  84. package/dist/umd/Host.d.ts +18 -0
  85. package/dist/umd/InstantDistributionAgreementV1.d.ts +107 -0
  86. package/dist/umd/Operation.d.ts +38 -0
  87. package/dist/umd/Query.d.ts +24 -0
  88. package/dist/umd/SFError.d.ts +13 -0
  89. package/dist/umd/SuperToken.d.ts +191 -0
  90. package/dist/umd/Token.d.ts +76 -0
  91. package/dist/umd/constants.d.ts +10 -0
  92. package/dist/umd/events.d.ts +254 -0
  93. package/dist/umd/frameworkHelpers.d.ts +20 -0
  94. package/dist/umd/index.d.ts +19 -0
  95. package/dist/umd/index.js +10782 -0
  96. package/dist/umd/interfaces.d.ts +309 -0
  97. package/dist/umd/mapGetAllEventsQueryEvents.d.ts +3 -0
  98. package/dist/umd/pagination.d.ts +31 -0
  99. package/dist/umd/scripts/setup.d.ts +22 -0
  100. package/dist/umd/subgraph/SubgraphClient.d.ts +16 -0
  101. package/dist/umd/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +41 -0
  102. package/dist/umd/subgraph/queries/getAllEvents.generated.d.ts +578 -0
  103. package/dist/umd/subgraph/queries/getIndexSubscriptions.generated.d.ts +42 -0
  104. package/dist/umd/subgraph/queries/getIndexes.generated.d.ts +40 -0
  105. package/dist/umd/subgraph/queries/getStreams.generated.d.ts +54 -0
  106. package/dist/umd/subgraph/queries/getTokens.generated.d.ts +23 -0
  107. package/dist/umd/subgraph/schema.generated.d.ts +6907 -0
  108. package/dist/umd/typechain/factories/ERC20WithTokenInfo__factory.d.ts +35 -0
  109. package/dist/umd/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +35 -0
  110. package/dist/umd/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +35 -0
  111. package/dist/umd/typechain/factories/IResolver__factory.d.ts +22 -0
  112. package/dist/umd/typechain/factories/SuperToken__factory.d.ts +46 -0
  113. package/dist/umd/typechain/factories/SuperfluidLoader__factory.d.ts +37 -0
  114. package/dist/umd/typechain/factories/Superfluid__factory.d.ts +82 -0
  115. package/dist/umd/typechain/factories/TestToken__factory.d.ts +46 -0
  116. package/dist/umd/typechain/index.d.ts +16 -0
  117. package/dist/umd/types.d.ts +2 -0
  118. package/dist/umd/utils.d.ts +89 -0
  119. package/dist/umd/validation.d.ts +8 -0
  120. package/package.json +76 -0
@@ -0,0 +1,35 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { ERC20WithTokenInfo, ERC20WithTokenInfoInterface } from "../ERC20WithTokenInfo";
4
+ export declare class ERC20WithTokenInfo__factory {
5
+ static readonly abi: ({
6
+ anonymous: boolean;
7
+ inputs: {
8
+ indexed: boolean;
9
+ internalType: string;
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ name: string;
14
+ type: string;
15
+ outputs?: undefined;
16
+ stateMutability?: undefined;
17
+ } | {
18
+ inputs: {
19
+ internalType: string;
20
+ name: string;
21
+ type: string;
22
+ }[];
23
+ name: string;
24
+ outputs: {
25
+ internalType: string;
26
+ name: string;
27
+ type: string;
28
+ }[];
29
+ stateMutability: string;
30
+ type: string;
31
+ anonymous?: undefined;
32
+ })[];
33
+ static createInterface(): ERC20WithTokenInfoInterface;
34
+ static connect(address: string, signerOrProvider: Signer | Provider): ERC20WithTokenInfo;
35
+ }
@@ -0,0 +1,35 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { IConstantFlowAgreementV1, IConstantFlowAgreementV1Interface } from "../IConstantFlowAgreementV1";
4
+ export declare class IConstantFlowAgreementV1__factory {
5
+ static readonly abi: ({
6
+ anonymous: boolean;
7
+ inputs: {
8
+ indexed: boolean;
9
+ internalType: string;
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ name: string;
14
+ type: string;
15
+ outputs?: undefined;
16
+ stateMutability?: undefined;
17
+ } | {
18
+ inputs: {
19
+ internalType: string;
20
+ name: string;
21
+ type: string;
22
+ }[];
23
+ name: string;
24
+ outputs: {
25
+ internalType: string;
26
+ name: string;
27
+ type: string;
28
+ }[];
29
+ stateMutability: string;
30
+ type: string;
31
+ anonymous?: undefined;
32
+ })[];
33
+ static createInterface(): IConstantFlowAgreementV1Interface;
34
+ static connect(address: string, signerOrProvider: Signer | Provider): IConstantFlowAgreementV1;
35
+ }
@@ -0,0 +1,35 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { IInstantDistributionAgreementV1, IInstantDistributionAgreementV1Interface } from "../IInstantDistributionAgreementV1";
4
+ export declare class IInstantDistributionAgreementV1__factory {
5
+ static readonly abi: ({
6
+ anonymous: boolean;
7
+ inputs: {
8
+ indexed: boolean;
9
+ internalType: string;
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ name: string;
14
+ type: string;
15
+ outputs?: undefined;
16
+ stateMutability?: undefined;
17
+ } | {
18
+ inputs: {
19
+ internalType: string;
20
+ name: string;
21
+ type: string;
22
+ }[];
23
+ name: string;
24
+ outputs: {
25
+ internalType: string;
26
+ name: string;
27
+ type: string;
28
+ }[];
29
+ stateMutability: string;
30
+ type: string;
31
+ anonymous?: undefined;
32
+ })[];
33
+ static createInterface(): IInstantDistributionAgreementV1Interface;
34
+ static connect(address: string, signerOrProvider: Signer | Provider): IInstantDistributionAgreementV1;
35
+ }
@@ -0,0 +1,22 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { IResolver, IResolverInterface } from "../IResolver";
4
+ export declare class IResolver__factory {
5
+ static readonly abi: {
6
+ inputs: {
7
+ internalType: string;
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ name: string;
12
+ outputs: {
13
+ internalType: string;
14
+ name: string;
15
+ type: string;
16
+ }[];
17
+ stateMutability: string;
18
+ type: string;
19
+ }[];
20
+ static createInterface(): IResolverInterface;
21
+ static connect(address: string, signerOrProvider: Signer | Provider): IResolver;
22
+ }
@@ -0,0 +1,46 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { SuperToken, SuperTokenInterface } from "../SuperToken";
4
+ export declare class SuperToken__factory {
5
+ static readonly abi: ({
6
+ inputs: {
7
+ internalType: string;
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ stateMutability: string;
12
+ type: string;
13
+ anonymous?: undefined;
14
+ name?: undefined;
15
+ outputs?: undefined;
16
+ } | {
17
+ anonymous: boolean;
18
+ inputs: {
19
+ indexed: boolean;
20
+ internalType: string;
21
+ name: string;
22
+ type: string;
23
+ }[];
24
+ name: string;
25
+ type: string;
26
+ stateMutability?: undefined;
27
+ outputs?: undefined;
28
+ } | {
29
+ inputs: {
30
+ internalType: string;
31
+ name: string;
32
+ type: string;
33
+ }[];
34
+ name: string;
35
+ outputs: {
36
+ internalType: string;
37
+ name: string;
38
+ type: string;
39
+ }[];
40
+ stateMutability: string;
41
+ type: string;
42
+ anonymous?: undefined;
43
+ })[];
44
+ static createInterface(): SuperTokenInterface;
45
+ static connect(address: string, signerOrProvider: Signer | Provider): SuperToken;
46
+ }
@@ -0,0 +1,37 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { SuperfluidLoader, SuperfluidLoaderInterface } from "../SuperfluidLoader";
4
+ export declare class SuperfluidLoader__factory {
5
+ static readonly abi: ({
6
+ inputs: {
7
+ internalType: string;
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ stateMutability: string;
12
+ type: string;
13
+ name?: undefined;
14
+ outputs?: undefined;
15
+ } | {
16
+ inputs: {
17
+ internalType: string;
18
+ name: string;
19
+ type: string;
20
+ }[];
21
+ name: string;
22
+ outputs: {
23
+ components: {
24
+ internalType: string;
25
+ name: string;
26
+ type: string;
27
+ }[];
28
+ internalType: string;
29
+ name: string;
30
+ type: string;
31
+ }[];
32
+ stateMutability: string;
33
+ type: string;
34
+ })[];
35
+ static createInterface(): SuperfluidLoaderInterface;
36
+ static connect(address: string, signerOrProvider: Signer | Provider): SuperfluidLoader;
37
+ }
@@ -0,0 +1,82 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { Superfluid, SuperfluidInterface } from "../Superfluid";
4
+ export declare class Superfluid__factory {
5
+ static readonly abi: ({
6
+ inputs: {
7
+ internalType: string;
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ stateMutability: string;
12
+ type: string;
13
+ anonymous?: undefined;
14
+ name?: undefined;
15
+ outputs?: undefined;
16
+ } | {
17
+ anonymous: boolean;
18
+ inputs: {
19
+ indexed: boolean;
20
+ internalType: string;
21
+ name: string;
22
+ type: string;
23
+ }[];
24
+ name: string;
25
+ type: string;
26
+ stateMutability?: undefined;
27
+ outputs?: undefined;
28
+ } | {
29
+ inputs: {
30
+ internalType: string;
31
+ name: string;
32
+ type: string;
33
+ }[];
34
+ name: string;
35
+ outputs: {
36
+ internalType: string;
37
+ name: string;
38
+ type: string;
39
+ }[];
40
+ stateMutability: string;
41
+ type: string;
42
+ anonymous?: undefined;
43
+ } | {
44
+ inputs: {
45
+ internalType: string;
46
+ name: string;
47
+ type: string;
48
+ }[];
49
+ name: string;
50
+ outputs: {
51
+ components: {
52
+ internalType: string;
53
+ name: string;
54
+ type: string;
55
+ }[];
56
+ internalType: string;
57
+ name: string;
58
+ type: string;
59
+ }[];
60
+ stateMutability: string;
61
+ type: string;
62
+ anonymous?: undefined;
63
+ } | {
64
+ inputs: {
65
+ components: {
66
+ internalType: string;
67
+ name: string;
68
+ type: string;
69
+ }[];
70
+ internalType: string;
71
+ name: string;
72
+ type: string;
73
+ }[];
74
+ name: string;
75
+ outputs: never[];
76
+ stateMutability: string;
77
+ type: string;
78
+ anonymous?: undefined;
79
+ })[];
80
+ static createInterface(): SuperfluidInterface;
81
+ static connect(address: string, signerOrProvider: Signer | Provider): Superfluid;
82
+ }
@@ -0,0 +1,46 @@
1
+ import { Signer } from "ethers";
2
+ import { Provider } from "@ethersproject/providers";
3
+ import type { TestToken, TestTokenInterface } from "../TestToken";
4
+ export declare class TestToken__factory {
5
+ static readonly abi: ({
6
+ inputs: {
7
+ internalType: string;
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ stateMutability: string;
12
+ type: string;
13
+ anonymous?: undefined;
14
+ name?: undefined;
15
+ outputs?: undefined;
16
+ } | {
17
+ anonymous: boolean;
18
+ inputs: {
19
+ indexed: boolean;
20
+ internalType: string;
21
+ name: string;
22
+ type: string;
23
+ }[];
24
+ name: string;
25
+ type: string;
26
+ stateMutability?: undefined;
27
+ outputs?: undefined;
28
+ } | {
29
+ inputs: {
30
+ internalType: string;
31
+ name: string;
32
+ type: string;
33
+ }[];
34
+ name: string;
35
+ outputs: {
36
+ internalType: string;
37
+ name: string;
38
+ type: string;
39
+ }[];
40
+ stateMutability: string;
41
+ type: string;
42
+ anonymous?: undefined;
43
+ })[];
44
+ static createInterface(): TestTokenInterface;
45
+ static connect(address: string, signerOrProvider: Signer | Provider): TestToken;
46
+ }
@@ -0,0 +1,16 @@
1
+ export type { ERC20WithTokenInfo } from "./ERC20WithTokenInfo";
2
+ export type { IConstantFlowAgreementV1 } from "./IConstantFlowAgreementV1";
3
+ export type { IInstantDistributionAgreementV1 } from "./IInstantDistributionAgreementV1";
4
+ export type { IResolver } from "./IResolver";
5
+ export type { Superfluid } from "./Superfluid";
6
+ export type { SuperfluidLoader } from "./SuperfluidLoader";
7
+ export type { SuperToken } from "./SuperToken";
8
+ export type { TestToken } from "./TestToken";
9
+ export { ERC20WithTokenInfo__factory } from "./factories/ERC20WithTokenInfo__factory";
10
+ export { IConstantFlowAgreementV1__factory } from "./factories/IConstantFlowAgreementV1__factory";
11
+ export { IInstantDistributionAgreementV1__factory } from "./factories/IInstantDistributionAgreementV1__factory";
12
+ export { IResolver__factory } from "./factories/IResolver__factory";
13
+ export { Superfluid__factory } from "./factories/Superfluid__factory";
14
+ export { SuperfluidLoader__factory } from "./factories/SuperfluidLoader__factory";
15
+ export { SuperToken__factory } from "./factories/SuperToken__factory";
16
+ export { TestToken__factory } from "./factories/TestToken__factory";
@@ -0,0 +1,2 @@
1
+ export declare type DataMode = "SUBGRAPH_ONLY" | "SUBGRAPH_WEB3" | "WEB3_ONLY";
2
+ export declare type FlowActionType = 0 | 1 | 2;
@@ -0,0 +1,89 @@
1
+ import { JsonFragment } from "@ethersproject/abi";
2
+ import { ethers } from "ethers";
3
+ import { IIndexSubscription } from "./interfaces";
4
+ /**
5
+ * @dev Checks if address is a valid ethereum address and normalizes so it can be used by both subgraph and web3.
6
+ * @param address
7
+ * @returns The normalized address.
8
+ */
9
+ export declare const normalizeAddress: (address?: string | undefined) => string;
10
+ export declare const isNullOrEmpty: (str: string | null | undefined) => boolean;
11
+ /**
12
+ * @dev Removes the 8-character signature hash from `callData`.
13
+ * @param callData
14
+ * @returns function parameters
15
+ */
16
+ export declare const removeSigHashFromCallData: (callData: string) => string;
17
+ /**
18
+ * @dev A wrapper function for getting the ethers TransactionDescription object given fragments (e.g. ABI), callData and the value amount sent.
19
+ * @param fragments ABI
20
+ * @param data callData of a function
21
+ * @param value amount of ether sent
22
+ * @returns ethers.TransactionDescription object
23
+ */
24
+ export declare const getTransactionDescription: (fragments: string | readonly (string | ethers.utils.Fragment | JsonFragment)[], data: string, value?: string | undefined) => ethers.utils.TransactionDescription;
25
+ /**
26
+ * @dev Gets the per second flow rate given an `amountPerYear` value.
27
+ * @param amountPerYear the amount you want to stream per year
28
+ * @returns flow rate per second
29
+ */
30
+ export declare const getPerSecondFlowRateByYear: (amountPerYear: string) => string;
31
+ /**
32
+ * @dev Gets the per second flow rate given an `amountPerMonth` value.
33
+ * @param amountPerMonth the amount you want to stream per month
34
+ * @returns flow rate per second
35
+ */
36
+ export declare const getPerSecondFlowRateByMonth: (amountPerMonth: string) => string;
37
+ /**
38
+ * @dev Gets the per second flow rate given an `amountPerDay` value.
39
+ * @param amountPerDay the amount you want to stream per day
40
+ * @returns flow rate per second
41
+ */
42
+ export declare const getPerSecondFlowRateByDay: (amountPerDay: string) => string;
43
+ /**
44
+ * @dev The formula for calculating the flowed amount since updated using Subgraph data.
45
+ * @param netFlowRate the net flow rate of the user
46
+ * @param currentTimestamp the current timestamp
47
+ * @param updatedAtTimestamp the updated at timestamp of the `AccountTokenSnapshot` entity
48
+ * @returns the flowed amount since the updatedAt timestamp
49
+ */
50
+ export declare const flowedAmountSinceUpdatedAt: ({ netFlowRate, currentTimestamp, updatedAtTimestamp, }: {
51
+ netFlowRate: string;
52
+ currentTimestamp: string;
53
+ updatedAtTimestamp: string;
54
+ }) => number;
55
+ /**
56
+ * @dev The formula for calculating the total amount distributed to the subscriber (pending or received).
57
+ * @param indexSubscriptions the index subscriptions of a single token from an account.
58
+ * @returns the total amount received since updated at (both pending and actually distributed)
59
+ */
60
+ export declare const subscriptionTotalAmountDistributedSinceUpdated: (indexSubscriptions: IIndexSubscription[]) => number;
61
+ /**
62
+ * @dev The formula for calculating the total amount received (approved subscriptions).
63
+ * @param indexSubscriptions the index subscriptions of a single token from an account.
64
+ * @returns the total amount received since updated at (actually distributed into wallet)
65
+ */
66
+ export declare const subscriptionTotalAmountReceivedSinceUpdated: (indexSubscriptions: IIndexSubscription[]) => number;
67
+ /**
68
+ * @dev The formula for calculating the total amount that is claimable.
69
+ * @param indexSubscriptions the index subscriptions of a single token from an account.
70
+ * @returns the total amount that can be claimed since updated at
71
+ */
72
+ export declare const subscriptionTotalAmountClaimableSinceUpdatedAt: (indexSubscriptions: IIndexSubscription[]) => number;
73
+ export declare const getStringCurrentTimeInSeconds: () => number;
74
+ export declare const getSanitizedTimestamp: (timestamp: ethers.BigNumberish) => Date;
75
+ /**
76
+ * @dev The formula for calculating the balance until updated at of a user (claimable + received tokens from index)
77
+ * @param currentBalance the current balance until updated at from the `AccountTokenSnapshot` entity
78
+ * @param netFlowRate the net flow rate of the user
79
+ * @param currentTimestamp the current timestamp
80
+ * @param updatedAtTimestamp the updated at timestamp of the `AccountTokenSnapshot` entity
81
+ * @returns the balance since the updated at timestamp
82
+ */
83
+ export declare const getBalance: ({ currentBalance, netFlowRate, currentTimestamp, updatedAtTimestamp, indexSubscriptions, }: {
84
+ currentBalance: string;
85
+ netFlowRate: string;
86
+ currentTimestamp: string;
87
+ updatedAtTimestamp: string;
88
+ indexSubscriptions: IIndexSubscription[];
89
+ }) => number;
@@ -0,0 +1,8 @@
1
+ import { IEventFilter } from ".";
2
+ import { IAccountTokenSnapshotFilter, IIndexRequestFilter, IIndexSubscriptionRequestFilter, IStreamRequestFilter, ISuperTokenRequestFilter } from "./interfaces";
3
+ export declare const validateSuperTokenRequest: (filter: ISuperTokenRequestFilter) => void;
4
+ export declare const validateEventRequest: (filter: IEventFilter) => void;
5
+ export declare const validateIndexRequest: (filter: IIndexRequestFilter) => void;
6
+ export declare const validateIndexSubscriptionRequest: (filter: IIndexSubscriptionRequestFilter) => void;
7
+ export declare const validateStreamRequest: (filter: IStreamRequestFilter) => void;
8
+ export declare const validateAccountTokenSnapshotRequest: (filter: IAccountTokenSnapshotFilter) => void;
@@ -0,0 +1,53 @@
1
+ import { ethers } from "ethers";
2
+ import Host from "./Host";
3
+ import { IConfig } from "./interfaces";
4
+ import Operation from "./Operation";
5
+ interface IBatchCallOptions {
6
+ config: IConfig;
7
+ operations: ReadonlyArray<Operation>;
8
+ }
9
+ interface OperationStruct {
10
+ readonly operationType: number;
11
+ readonly target: string;
12
+ readonly data: string;
13
+ }
14
+ /**
15
+ * @dev BatchCall Helper Class
16
+ * @description A helper class to create `BatchCall` objects which can be executed.
17
+ */
18
+ export default class BatchCall {
19
+ options: IBatchCallOptions;
20
+ host: Host;
21
+ constructor(options: IBatchCallOptions);
22
+ /**
23
+ * @dev Gets the call agreement function arguments.
24
+ * @param callData callData of the function
25
+ * @returns {ethers.utils.Result} call agreement function arguments
26
+ */
27
+ getCallAgreementFunctionArgs: (callData: string) => ethers.utils.Result;
28
+ /**
29
+ * @dev Given an `Operation` object, gets the `OperationStruct` object.
30
+ * @param operation an `Operation` object
31
+ * @param index the index of the `Operation` in the batchCall
32
+ * @returns {Promise<OperationStruct>} OperationStruct object for batchCall
33
+ */
34
+ getOperationStruct: (operation: Operation, index: number) => Promise<OperationStruct>;
35
+ /**
36
+ * @dev Gets an array of `OperationStruct` objects to be passed to batchCall.
37
+ * @returns {Promise<OperationStruct>[]} array of operation struct promises
38
+ */
39
+ get getOperationStructArrayPromises(): Promise<OperationStruct>[];
40
+ /**
41
+ * @dev Executes a batch call given the operations on this class.
42
+ * @param signer the signer of the transaction
43
+ * @returns {Promise<ethers.ContractTransaction>} ContractTransaction object
44
+ */
45
+ exec: (signer: ethers.Signer) => Promise<ethers.ContractTransaction>;
46
+ /**
47
+ * @dev Executes a forward batch call given the operations on this class.
48
+ * @param signer the signer of the transaction
49
+ * @returns {Promise<ethers.ContractTransaction>} ContractTransaction object
50
+ */
51
+ execForward: (signer: ethers.Signer) => Promise<ethers.ContractTransaction>;
52
+ }
53
+ export {};
@@ -0,0 +1,74 @@
1
+ import { IAgreementV1Options, ICreateFlowParams, IDeleteFlowParams, IUpdateFlowParams, IGetFlowParams, IGetAccountFlowInfoParams, IWeb3FlowInfoParams, IWeb3FlowInfo } from "./interfaces";
2
+ import Operation from "./Operation";
3
+ import Host from "./Host";
4
+ /**
5
+ * @dev Constant Flow Agreement V1 Helper Class
6
+ * @description A helper class to interact with the CFAV1 contract.
7
+ */
8
+ export default class ConstantFlowAgreementV1 {
9
+ readonly options: IAgreementV1Options;
10
+ readonly host: Host;
11
+ constructor(options: IAgreementV1Options);
12
+ private get cfaContract();
13
+ /**
14
+ * @dev Get the details of a flow.
15
+ * @param superToken the superToken of the agreement
16
+ * @param sender the sender of the flow
17
+ * @param receiver the receiver of the flow
18
+ * @param providerOrSigner a provider or signer object
19
+ * @returns {Promise<IWeb3FlowInfo>} Web3 Flow info object
20
+ */
21
+ getFlow: ({ superToken, sender, receiver, providerOrSigner, }: IGetFlowParams) => Promise<IWeb3FlowInfo>;
22
+ /**
23
+ * @dev Get the flow info of an account (net flow).
24
+ * @param superToken the superToken of the agreement
25
+ * @param account the account we're querying
26
+ * @param providerOrSigner a provider or signer object
27
+ * @returns {Promise<IWeb3FlowInfo>} Web3 Flow info object
28
+ */
29
+ getAccountFlowInfo: ({ superToken, account, providerOrSigner, }: IGetAccountFlowInfoParams) => Promise<IWeb3FlowInfo>;
30
+ /**
31
+ * @dev Get the net flow of an account.
32
+ * @param superToken the superToken of the agreement
33
+ * @param account the account we're querying
34
+ * @param providerOrSigner a provider or signer object
35
+ * @returns {Promise<string>} Web3 Flow info object
36
+ */
37
+ getNetFlow: ({ superToken, account, providerOrSigner, }: IGetAccountFlowInfoParams) => Promise<string>;
38
+ /**
39
+ * @dev Create a flow.
40
+ * @param flowRate The specified flow rate.
41
+ * @param receiver The receiver of the flow.
42
+ * @param superToken The token to be flowed.
43
+ * @param userData Extra user data provided.
44
+ * @returns {Operation} An instance of Operation which can be executed or batched.
45
+ */
46
+ createFlow: ({ flowRate, receiver, superToken, userData, }: ICreateFlowParams) => Operation;
47
+ /**
48
+ * @dev Update a flow.
49
+ * @param flowRate The specified flow rate.
50
+ * @param receiver The receiver of the flow.
51
+ * @param superToken The token to be flowed.
52
+ * @param userData Extra user data provided.
53
+ * @returns {Operation} An instance of Operation which can be executed or batched.
54
+ */
55
+ updateFlow: ({ flowRate, receiver, superToken, userData, }: IUpdateFlowParams) => Operation;
56
+ /**
57
+ * @dev Delete a flow.
58
+ * @param superToken The token to be flowed.
59
+ * @param sender The sender of the flow.
60
+ * @param receiver The receiver of the flow.
61
+ * @param userData Extra user data provided.
62
+ * @returns {Operation} An instance of Operation which can be executed or batched.
63
+ */
64
+ deleteFlow: ({ superToken, sender, receiver, userData, }: IDeleteFlowParams) => Operation;
65
+ /**
66
+ * @dev Sanitizes flow info, converting BigNumber to string.
67
+ * @param timestamp last updated timestamp of flow
68
+ * @param flowRate the current flow rate
69
+ * @param deposit the deposit amount
70
+ * @param owedDeposit any owed depsit
71
+ * @returns {IWeb3FlowInfo} sanitized web3 flow info
72
+ */
73
+ _sanitizeflowInfo: ({ timestamp, flowRate, deposit, owedDeposit, }: IWeb3FlowInfoParams) => IWeb3FlowInfo;
74
+ }
@@ -0,0 +1,75 @@
1
+ import { ethers } from "ethers";
2
+ import { Signer } from "@ethersproject/abstract-signer";
3
+ import { IConfig, ISignerConstructorOptions } from "./interfaces";
4
+ import { DataMode } from "./types";
5
+ import BatchCall from "./BatchCall";
6
+ import ConstantFlowAgreementV1 from "./ConstantFlowAgreementV1";
7
+ import Host from "./Host";
8
+ import InstantDistributionAgreementV1 from "./InstantDistributionAgreementV1";
9
+ import SuperToken from "./SuperToken";
10
+ import Query from "./Query";
11
+ import Operation from "./Operation";
12
+ export interface IFrameworkOptions {
13
+ chainId?: number;
14
+ customSubgraphQueriesEndpoint?: string;
15
+ dataMode?: DataMode;
16
+ networkName?: string;
17
+ resolverAddress?: string;
18
+ protocolReleaseVersion?: string;
19
+ provider: ethers.providers.Provider;
20
+ }
21
+ export interface IFrameworkSettings {
22
+ chainId: number;
23
+ customSubgraphQueriesEndpoint: string;
24
+ dataMode: DataMode;
25
+ networkName: string;
26
+ protocolReleaseVersion: string;
27
+ provider: ethers.providers.Provider;
28
+ config: IConfig;
29
+ }
30
+ /**
31
+ * @dev Superfluid Framework Class
32
+ * @description The entrypoint for the SDK-core, `create` an instance of this for full functionality.
33
+ */
34
+ export default class Framework {
35
+ readonly userInputOptions: IFrameworkOptions;
36
+ settings: IFrameworkSettings;
37
+ cfaV1: ConstantFlowAgreementV1;
38
+ host: Host;
39
+ idaV1: InstantDistributionAgreementV1;
40
+ query: Query;
41
+ private constructor();
42
+ /**
43
+ * @dev Creates the Framework object based on user provided `options`.
44
+ * @param options.chainId the chainId of your desired network (e.g. 137 = matic)
45
+ * @param options.customSubgraphQueriesEndpoint your custom subgraph endpoint
46
+ * @param options.dataMode the data mode you'd like the framework to use (SUBGRAPH_ONLY, SUBGRAPH_WEB3, WEB3_ONLY)
47
+ * @param options.networkName the desired network (e.g. "matic", "rinkeby", etc.)
48
+ * @param options.resolverAddress a custom resolver address (advanced use for testing)
49
+ * @param options.protocolReleaseVersion a custom release version (advanced use for testing)
50
+ * @param options.provider a provider object necessary for initializing the framework
51
+ * @returns `Framework` class
52
+ */
53
+ static create: (options: IFrameworkOptions) => Promise<Framework>;
54
+ /**
55
+ * @dev Create a signer which can be used to sign transactions.
56
+ * @param options.web3Provider a Web3Provider object (e.g. client side - metamask, web3modal)
57
+ * @param options.provider an ethers Provider object (e.g. via Hardhat ethers)
58
+ * @param options.privateKey a test account private key
59
+ * @param options.signer a signer object (e.g. ethers.Wallet instance)
60
+ * @returns `ethers.Signer` object
61
+ */
62
+ createSigner: (options: ISignerConstructorOptions) => Signer;
63
+ /**
64
+ * @dev Create a `BatchCall` class from the `Framework`.
65
+ * @param operations the list of operations to execute
66
+ * @returns `BatchCall` class
67
+ */
68
+ batchCall: (operations: Operation[]) => BatchCall;
69
+ /**
70
+ * @dev Load a `SuperToken` class from the `Framework`.
71
+ * @param address the `SuperToken` address
72
+ * @returns `SuperToken` class
73
+ */
74
+ loadSuperToken: (address: string) => Promise<SuperToken>;
75
+ }