@superfluid-finance/sdk-core 0.1.0 → 0.1.1-dev.087c350.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +453 -76
- package/dist/index.umd.js +45852 -0
- package/dist/main/BatchCall.d.ts +2 -1
- package/dist/main/BatchCall.d.ts.map +1 -0
- package/dist/main/BatchCall.js +128 -0
- package/dist/main/BatchCall.js.map +1 -0
- package/dist/main/ConstantFlowAgreementV1.d.ts +9 -5
- package/dist/main/ConstantFlowAgreementV1.d.ts.map +1 -0
- package/dist/main/ConstantFlowAgreementV1.js +178 -0
- package/dist/main/ConstantFlowAgreementV1.js.map +1 -0
- package/dist/main/Framework.d.ts +12 -7
- package/dist/main/Framework.d.ts.map +1 -0
- package/dist/main/Framework.js +177 -0
- package/dist/main/Framework.js.map +1 -0
- package/dist/main/Host.d.ts +6 -1
- package/dist/main/Host.d.ts.map +1 -0
- package/dist/main/Host.js +31 -0
- package/dist/main/Host.js.map +1 -0
- package/dist/main/InstantDistributionAgreementV1.d.ts +19 -10
- package/dist/main/InstantDistributionAgreementV1.d.ts.map +1 -0
- package/dist/main/InstantDistributionAgreementV1.js +249 -0
- package/dist/main/InstantDistributionAgreementV1.js.map +1 -0
- package/dist/main/Operation.d.ts +1 -0
- package/dist/main/Operation.d.ts.map +1 -0
- package/dist/main/Operation.js +86 -0
- package/dist/main/Operation.js.map +1 -0
- package/dist/main/Query.d.ts +4 -3
- package/dist/main/Query.d.ts.map +1 -0
- package/dist/main/Query.js +310 -0
- package/dist/main/Query.js.map +1 -0
- package/dist/main/SFError.d.ts +1 -0
- package/dist/main/SFError.d.ts.map +1 -0
- package/dist/main/SFError.js +36 -0
- package/dist/main/SFError.js.map +1 -0
- package/dist/main/SuperToken.d.ts +36 -16
- package/dist/main/SuperToken.d.ts.map +1 -0
- package/dist/main/SuperToken.js +396 -0
- package/dist/main/SuperToken.js.map +1 -0
- package/dist/main/Token.d.ts +8 -4
- package/dist/main/Token.d.ts.map +1 -0
- package/dist/main/Token.js +166 -0
- package/dist/main/Token.js.map +1 -0
- package/dist/main/abi/ERC20WithTokenInfo.json +224 -0
- package/dist/main/abi/IConstantFlowAgreementV1.json +406 -0
- package/dist/main/abi/IInstantDistributionAgreementV1.json +947 -0
- package/dist/main/abi/IResolver.json +58 -0
- package/dist/main/abi/SuperToken.json +1549 -0
- package/dist/main/abi/Superfluid.json +1159 -0
- package/dist/main/abi/SuperfluidLoader.json +54 -0
- package/dist/main/constants.d.ts +9 -1
- package/dist/main/constants.d.ts.map +1 -0
- package/dist/main/constants.js +134 -0
- package/dist/main/constants.js.map +1 -0
- package/dist/main/events.d.ts +1 -0
- package/dist/main/events.d.ts.map +1 -0
- package/dist/main/events.js +3 -0
- package/dist/main/events.js.map +1 -0
- package/dist/main/frameworkHelpers.d.ts +1 -0
- package/dist/main/frameworkHelpers.d.ts.map +1 -0
- package/dist/main/frameworkHelpers.js +89 -0
- package/dist/main/frameworkHelpers.js.map +1 -0
- package/dist/main/index.d.ts +11 -5
- package/dist/main/index.d.ts.map +1 -0
- package/dist/main/index.js +38 -7522
- package/dist/main/index.js.map +1 -0
- package/dist/main/interfaces.d.ts +103 -16
- package/dist/main/interfaces.d.ts.map +1 -0
- package/dist/main/interfaces.js +3 -0
- package/dist/main/interfaces.js.map +1 -0
- package/dist/main/mapGetAllEventsQueryEvents.d.ts +1 -0
- package/dist/main/mapGetAllEventsQueryEvents.d.ts.map +1 -0
- package/dist/main/mapGetAllEventsQueryEvents.js +432 -0
- package/dist/main/mapGetAllEventsQueryEvents.js.map +1 -0
- package/dist/main/ordering.d.ts +2 -1
- package/dist/main/ordering.d.ts.map +1 -0
- package/dist/main/ordering.js +3 -0
- package/dist/main/ordering.js.map +1 -0
- package/dist/main/pagination.d.ts +3 -2
- package/dist/main/pagination.d.ts.map +1 -0
- package/dist/main/pagination.js +60 -0
- package/dist/main/pagination.js.map +1 -0
- package/dist/main/subgraph/SubgraphClient.d.ts +1 -0
- package/dist/main/subgraph/SubgraphClient.d.ts.map +1 -0
- package/dist/main/subgraph/SubgraphClient.js +51 -0
- package/dist/main/subgraph/SubgraphClient.js.map +1 -0
- package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +1 -0
- package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.d.ts.map +1 -0
- package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.js +5 -0
- package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.js.map +1 -0
- package/dist/main/subgraph/queries/getAllEvents.generated.d.ts +5 -4
- package/dist/main/subgraph/queries/getAllEvents.generated.d.ts.map +1 -0
- package/dist/main/subgraph/queries/getAllEvents.generated.js +6 -0
- package/dist/main/subgraph/queries/getAllEvents.generated.js.map +1 -0
- package/dist/main/subgraph/queries/getIndexSubscriptions.generated.d.ts +1 -0
- package/dist/main/subgraph/queries/getIndexSubscriptions.generated.d.ts.map +1 -0
- package/dist/main/subgraph/queries/getIndexSubscriptions.generated.js +5 -0
- package/dist/main/subgraph/queries/getIndexSubscriptions.generated.js.map +1 -0
- package/dist/main/subgraph/queries/getIndexes.generated.d.ts +1 -0
- package/dist/main/subgraph/queries/getIndexes.generated.d.ts.map +1 -0
- package/dist/main/subgraph/queries/getIndexes.generated.js +5 -0
- package/dist/main/subgraph/queries/getIndexes.generated.js.map +1 -0
- package/dist/main/subgraph/queries/getStreams.generated.d.ts +1 -0
- package/dist/main/subgraph/queries/getStreams.generated.d.ts.map +1 -0
- package/dist/main/subgraph/queries/getStreams.generated.js +5 -0
- package/dist/main/subgraph/queries/getStreams.generated.js.map +1 -0
- package/dist/main/subgraph/queries/getTokens.generated.d.ts +1 -0
- package/dist/main/subgraph/queries/getTokens.generated.d.ts.map +1 -0
- package/dist/main/subgraph/queries/getTokens.generated.js +5 -0
- package/dist/main/subgraph/queries/getTokens.generated.js.map +1 -0
- package/dist/main/subgraph/schema.generated.d.ts +34 -42
- package/dist/main/subgraph/schema.generated.d.ts.map +1 -0
- package/dist/main/subgraph/schema.generated.js +3 -0
- package/dist/main/subgraph/schema.generated.js.map +1 -0
- package/dist/main/typechain/ERC20WithTokenInfo.d.ts +1 -0
- package/dist/main/typechain/ERC20WithTokenInfo.d.ts.map +1 -0
- package/dist/main/typechain/ERC20WithTokenInfo.js +3 -0
- package/dist/main/typechain/ERC20WithTokenInfo.js.map +1 -0
- package/dist/main/typechain/IConstantFlowAgreementV1.d.ts +1 -0
- package/dist/main/typechain/IConstantFlowAgreementV1.d.ts.map +1 -0
- package/dist/main/typechain/IConstantFlowAgreementV1.js +3 -0
- package/dist/main/typechain/IConstantFlowAgreementV1.js.map +1 -0
- package/dist/main/typechain/IInstantDistributionAgreementV1.d.ts +1 -0
- package/dist/main/typechain/IInstantDistributionAgreementV1.d.ts.map +1 -0
- package/dist/main/typechain/IInstantDistributionAgreementV1.js +3 -0
- package/dist/main/typechain/IInstantDistributionAgreementV1.js.map +1 -0
- package/dist/main/typechain/IResolver.d.ts +18 -3
- package/dist/main/typechain/IResolver.d.ts.map +1 -0
- package/dist/main/typechain/IResolver.js +3 -0
- package/dist/main/typechain/IResolver.js.map +1 -0
- package/dist/main/typechain/SuperToken.d.ts +1 -0
- package/dist/main/typechain/SuperToken.d.ts.map +1 -0
- package/dist/main/typechain/SuperToken.js +3 -0
- package/dist/main/typechain/SuperToken.js.map +1 -0
- package/dist/main/typechain/Superfluid.d.ts +1 -0
- package/dist/main/typechain/Superfluid.d.ts.map +1 -0
- package/dist/main/typechain/Superfluid.js +3 -0
- package/dist/main/typechain/Superfluid.js.map +1 -0
- package/dist/main/typechain/SuperfluidLoader.d.ts +1 -0
- package/dist/main/typechain/SuperfluidLoader.d.ts.map +1 -0
- package/dist/main/typechain/SuperfluidLoader.js +3 -0
- package/dist/main/typechain/SuperfluidLoader.js.map +1 -0
- package/dist/main/typechain/TestToken.d.ts +9 -0
- package/dist/main/typechain/TestToken.d.ts.map +1 -0
- package/dist/main/typechain/TestToken.js +3 -0
- package/dist/main/typechain/TestToken.js.map +1 -0
- package/dist/main/typechain/common.d.ts +1 -0
- package/dist/main/typechain/common.d.ts.map +1 -0
- package/dist/main/typechain/common.js +3 -0
- package/dist/main/typechain/common.js.map +1 -0
- package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.d.ts +1 -0
- package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.js +242 -0
- package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.js.map +1 -0
- package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +1 -0
- package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.js +424 -0
- package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.js.map +1 -0
- package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +1 -0
- package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.js +965 -0
- package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.js.map +1 -0
- package/dist/main/typechain/factories/IResolver__factory.d.ts +16 -2
- package/dist/main/typechain/factories/IResolver__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/IResolver__factory.js +76 -0
- package/dist/main/typechain/factories/IResolver__factory.js.map +1 -0
- package/dist/main/typechain/factories/SuperToken__factory.d.ts +1 -0
- package/dist/main/typechain/factories/SuperToken__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/SuperToken__factory.js +1567 -0
- package/dist/main/typechain/factories/SuperToken__factory.js.map +1 -0
- package/dist/main/typechain/factories/SuperfluidLoader__factory.d.ts +1 -0
- package/dist/main/typechain/factories/SuperfluidLoader__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/SuperfluidLoader__factory.js +72 -0
- package/dist/main/typechain/factories/SuperfluidLoader__factory.js.map +1 -0
- package/dist/main/typechain/factories/Superfluid__factory.d.ts +1 -0
- package/dist/main/typechain/factories/Superfluid__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/Superfluid__factory.js +1177 -0
- package/dist/main/typechain/factories/Superfluid__factory.js.map +1 -0
- package/dist/main/typechain/factories/TestToken__factory.d.ts +1 -0
- package/dist/main/typechain/factories/TestToken__factory.d.ts.map +1 -0
- package/dist/main/typechain/factories/TestToken__factory.js +348 -0
- package/dist/main/typechain/factories/TestToken__factory.js.map +1 -0
- package/dist/main/typechain/index.d.ts +1 -0
- package/dist/main/typechain/index.d.ts.map +1 -0
- package/dist/main/typechain/index.js +20 -0
- package/dist/main/typechain/index.js.map +1 -0
- package/dist/main/types.d.ts +1 -0
- package/dist/main/types.d.ts.map +1 -0
- package/dist/main/types.js +3 -0
- package/dist/main/types.js.map +1 -0
- package/dist/main/utils.d.ts +23 -0
- package/dist/main/utils.d.ts.map +1 -0
- package/dist/main/utils.js +178 -0
- package/dist/main/utils.js.map +1 -0
- package/dist/main/validation.d.ts +2 -1
- package/dist/main/validation.d.ts.map +1 -0
- package/dist/main/validation.js +98 -0
- package/dist/main/validation.js.map +1 -0
- package/dist/module/BatchCall.d.ts +2 -1
- package/dist/module/BatchCall.d.ts.map +1 -0
- package/dist/module/BatchCall.js +122 -0
- package/dist/module/BatchCall.js.map +1 -0
- package/dist/module/ConstantFlowAgreementV1.d.ts +9 -5
- package/dist/module/ConstantFlowAgreementV1.d.ts.map +1 -0
- package/dist/module/ConstantFlowAgreementV1.js +172 -0
- package/dist/module/ConstantFlowAgreementV1.js.map +1 -0
- package/dist/module/Framework.d.ts +12 -7
- package/dist/module/Framework.d.ts.map +1 -0
- package/dist/module/Framework.js +171 -0
- package/dist/module/Framework.js.map +1 -0
- package/dist/module/Host.d.ts +6 -1
- package/dist/module/Host.d.ts.map +1 -0
- package/dist/module/Host.js +25 -0
- package/dist/module/Host.js.map +1 -0
- package/dist/module/InstantDistributionAgreementV1.d.ts +19 -10
- package/dist/module/InstantDistributionAgreementV1.d.ts.map +1 -0
- package/dist/module/InstantDistributionAgreementV1.js +243 -0
- package/dist/module/InstantDistributionAgreementV1.js.map +1 -0
- package/dist/module/Operation.d.ts +1 -0
- package/dist/module/Operation.d.ts.map +1 -0
- package/dist/module/Operation.js +80 -0
- package/dist/module/Operation.js.map +1 -0
- package/dist/module/Query.d.ts +4 -3
- package/dist/module/Query.d.ts.map +1 -0
- package/dist/module/Query.js +304 -0
- package/dist/module/Query.js.map +1 -0
- package/dist/module/SFError.d.ts +1 -0
- package/dist/module/SFError.d.ts.map +1 -0
- package/dist/module/SFError.js +33 -0
- package/dist/module/SFError.js.map +1 -0
- package/dist/module/SuperToken.d.ts +36 -16
- package/dist/module/SuperToken.d.ts.map +1 -0
- package/dist/module/SuperToken.js +390 -0
- package/dist/module/SuperToken.js.map +1 -0
- package/dist/module/Token.d.ts +8 -4
- package/dist/module/Token.d.ts.map +1 -0
- package/dist/module/Token.js +160 -0
- package/dist/module/Token.js.map +1 -0
- package/dist/module/abi/ERC20WithTokenInfo.json +224 -0
- package/dist/module/abi/IConstantFlowAgreementV1.json +406 -0
- package/dist/module/abi/IInstantDistributionAgreementV1.json +947 -0
- package/dist/module/abi/IResolver.json +58 -0
- package/dist/module/abi/SuperToken.json +1549 -0
- package/dist/module/abi/Superfluid.json +1159 -0
- package/dist/module/abi/SuperfluidLoader.json +54 -0
- package/dist/module/constants.d.ts +9 -1
- package/dist/module/constants.d.ts.map +1 -0
- package/dist/module/constants.js +131 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/events.d.ts +1 -0
- package/dist/module/events.d.ts.map +1 -0
- package/dist/module/events.js +2 -0
- package/dist/module/events.js.map +1 -0
- package/dist/module/frameworkHelpers.d.ts +1 -0
- package/dist/module/frameworkHelpers.d.ts.map +1 -0
- package/dist/module/frameworkHelpers.js +80 -0
- package/dist/module/frameworkHelpers.js.map +1 -0
- package/dist/module/index.d.ts +11 -5
- package/dist/module/index.d.ts.map +1 -0
- package/dist/module/index.js +25 -7488
- package/dist/module/index.js.map +1 -0
- package/dist/module/interfaces.d.ts +103 -16
- package/dist/module/interfaces.d.ts.map +1 -0
- package/dist/module/interfaces.js +2 -0
- package/dist/module/interfaces.js.map +1 -0
- package/dist/module/mapGetAllEventsQueryEvents.d.ts +1 -0
- package/dist/module/mapGetAllEventsQueryEvents.d.ts.map +1 -0
- package/dist/module/mapGetAllEventsQueryEvents.js +428 -0
- package/dist/module/mapGetAllEventsQueryEvents.js.map +1 -0
- package/dist/module/ordering.d.ts +2 -1
- package/dist/module/ordering.d.ts.map +1 -0
- package/dist/module/ordering.js +2 -0
- package/dist/module/ordering.js.map +1 -0
- package/dist/module/pagination.d.ts +3 -2
- package/dist/module/pagination.d.ts.map +1 -0
- package/dist/module/pagination.js +51 -0
- package/dist/module/pagination.js.map +1 -0
- package/dist/module/subgraph/SubgraphClient.d.ts +1 -0
- package/dist/module/subgraph/SubgraphClient.d.ts.map +1 -0
- package/dist/module/subgraph/SubgraphClient.js +44 -0
- package/dist/module/subgraph/SubgraphClient.js.map +1 -0
- package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +1 -0
- package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.d.ts.map +1 -0
- package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.js +2 -0
- package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.js.map +1 -0
- package/dist/module/subgraph/queries/getAllEvents.generated.d.ts +5 -4
- package/dist/module/subgraph/queries/getAllEvents.generated.d.ts.map +1 -0
- package/dist/module/subgraph/queries/getAllEvents.generated.js +3 -0
- package/dist/module/subgraph/queries/getAllEvents.generated.js.map +1 -0
- package/dist/module/subgraph/queries/getIndexSubscriptions.generated.d.ts +1 -0
- package/dist/module/subgraph/queries/getIndexSubscriptions.generated.d.ts.map +1 -0
- package/dist/module/subgraph/queries/getIndexSubscriptions.generated.js +2 -0
- package/dist/module/subgraph/queries/getIndexSubscriptions.generated.js.map +1 -0
- package/dist/module/subgraph/queries/getIndexes.generated.d.ts +1 -0
- package/dist/module/subgraph/queries/getIndexes.generated.d.ts.map +1 -0
- package/dist/module/subgraph/queries/getIndexes.generated.js +2 -0
- package/dist/module/subgraph/queries/getIndexes.generated.js.map +1 -0
- package/dist/module/subgraph/queries/getStreams.generated.d.ts +1 -0
- package/dist/module/subgraph/queries/getStreams.generated.d.ts.map +1 -0
- package/dist/module/subgraph/queries/getStreams.generated.js +2 -0
- package/dist/module/subgraph/queries/getStreams.generated.js.map +1 -0
- package/dist/module/subgraph/queries/getTokens.generated.d.ts +1 -0
- package/dist/module/subgraph/queries/getTokens.generated.d.ts.map +1 -0
- package/dist/module/subgraph/queries/getTokens.generated.js +2 -0
- package/dist/module/subgraph/queries/getTokens.generated.js.map +1 -0
- package/dist/module/subgraph/schema.generated.d.ts +34 -42
- package/dist/module/subgraph/schema.generated.d.ts.map +1 -0
- package/dist/module/subgraph/schema.generated.js +2 -0
- package/dist/module/subgraph/schema.generated.js.map +1 -0
- package/dist/module/typechain/ERC20WithTokenInfo.d.ts +1 -0
- package/dist/module/typechain/ERC20WithTokenInfo.d.ts.map +1 -0
- package/dist/module/typechain/ERC20WithTokenInfo.js +2 -0
- package/dist/module/typechain/ERC20WithTokenInfo.js.map +1 -0
- package/dist/module/typechain/IConstantFlowAgreementV1.d.ts +1 -0
- package/dist/module/typechain/IConstantFlowAgreementV1.d.ts.map +1 -0
- package/dist/module/typechain/IConstantFlowAgreementV1.js +2 -0
- package/dist/module/typechain/IConstantFlowAgreementV1.js.map +1 -0
- package/dist/module/typechain/IInstantDistributionAgreementV1.d.ts +1 -0
- package/dist/module/typechain/IInstantDistributionAgreementV1.d.ts.map +1 -0
- package/dist/module/typechain/IInstantDistributionAgreementV1.js +2 -0
- package/dist/module/typechain/IInstantDistributionAgreementV1.js.map +1 -0
- package/dist/module/typechain/IResolver.d.ts +18 -3
- package/dist/module/typechain/IResolver.d.ts.map +1 -0
- package/dist/module/typechain/IResolver.js +2 -0
- package/dist/module/typechain/IResolver.js.map +1 -0
- package/dist/module/typechain/SuperToken.d.ts +1 -0
- package/dist/module/typechain/SuperToken.d.ts.map +1 -0
- package/dist/module/typechain/SuperToken.js +2 -0
- package/dist/module/typechain/SuperToken.js.map +1 -0
- package/dist/module/typechain/Superfluid.d.ts +1 -0
- package/dist/module/typechain/Superfluid.d.ts.map +1 -0
- package/dist/module/typechain/Superfluid.js +2 -0
- package/dist/module/typechain/Superfluid.js.map +1 -0
- package/dist/module/typechain/SuperfluidLoader.d.ts +1 -0
- package/dist/module/typechain/SuperfluidLoader.d.ts.map +1 -0
- package/dist/module/typechain/SuperfluidLoader.js +2 -0
- package/dist/module/typechain/SuperfluidLoader.js.map +1 -0
- package/dist/module/typechain/TestToken.d.ts +9 -0
- package/dist/module/typechain/TestToken.d.ts.map +1 -0
- package/dist/module/typechain/TestToken.js +2 -0
- package/dist/module/typechain/TestToken.js.map +1 -0
- package/dist/module/typechain/common.d.ts +1 -0
- package/dist/module/typechain/common.d.ts.map +1 -0
- package/dist/module/typechain/common.js +2 -0
- package/dist/module/typechain/common.js.map +1 -0
- package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.d.ts +1 -0
- package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.js +238 -0
- package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.js.map +1 -0
- package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +1 -0
- package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.js +420 -0
- package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.js.map +1 -0
- package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +1 -0
- package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.js +961 -0
- package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.js.map +1 -0
- package/dist/module/typechain/factories/IResolver__factory.d.ts +16 -2
- package/dist/module/typechain/factories/IResolver__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/IResolver__factory.js +72 -0
- package/dist/module/typechain/factories/IResolver__factory.js.map +1 -0
- package/dist/module/typechain/factories/SuperToken__factory.d.ts +1 -0
- package/dist/module/typechain/factories/SuperToken__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/SuperToken__factory.js +1563 -0
- package/dist/module/typechain/factories/SuperToken__factory.js.map +1 -0
- package/dist/module/typechain/factories/SuperfluidLoader__factory.d.ts +1 -0
- package/dist/module/typechain/factories/SuperfluidLoader__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/SuperfluidLoader__factory.js +68 -0
- package/dist/module/typechain/factories/SuperfluidLoader__factory.js.map +1 -0
- package/dist/module/typechain/factories/Superfluid__factory.d.ts +1 -0
- package/dist/module/typechain/factories/Superfluid__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/Superfluid__factory.js +1173 -0
- package/dist/module/typechain/factories/Superfluid__factory.js.map +1 -0
- package/dist/module/typechain/factories/TestToken__factory.d.ts +1 -0
- package/dist/module/typechain/factories/TestToken__factory.d.ts.map +1 -0
- package/dist/module/typechain/factories/TestToken__factory.js +344 -0
- package/dist/module/typechain/factories/TestToken__factory.js.map +1 -0
- package/dist/module/typechain/index.d.ts +1 -0
- package/dist/module/typechain/index.d.ts.map +1 -0
- package/dist/{umd/typechain/index.d.ts → module/typechain/index.js} +1 -8
- package/dist/module/typechain/index.js.map +1 -0
- package/dist/module/types.d.ts +1 -0
- package/dist/module/types.d.ts.map +1 -0
- package/dist/module/types.js +2 -0
- package/dist/module/types.js.map +1 -0
- package/dist/module/utils.d.ts +23 -0
- package/dist/module/utils.d.ts.map +1 -0
- package/dist/module/utils.js +153 -0
- package/dist/module/utils.js.map +1 -0
- package/dist/module/validation.d.ts +2 -1
- package/dist/module/validation.d.ts.map +1 -0
- package/dist/module/validation.js +92 -0
- package/dist/module/validation.js.map +1 -0
- package/package.json +36 -17
- package/dist/umd/BatchCall.d.ts +0 -53
- package/dist/umd/ConstantFlowAgreementV1.d.ts +0 -74
- package/dist/umd/Framework.d.ts +0 -75
- package/dist/umd/Host.d.ts +0 -18
- package/dist/umd/InstantDistributionAgreementV1.d.ts +0 -107
- package/dist/umd/Operation.d.ts +0 -38
- package/dist/umd/Query.d.ts +0 -31
- package/dist/umd/SFError.d.ts +0 -13
- package/dist/umd/SuperToken.d.ts +0 -191
- package/dist/umd/Token.d.ts +0 -76
- package/dist/umd/constants.d.ts +0 -10
- package/dist/umd/events.d.ts +0 -255
- package/dist/umd/frameworkHelpers.d.ts +0 -20
- package/dist/umd/index.d.ts +0 -19
- package/dist/umd/index.js +0 -7524
- package/dist/umd/interfaces.d.ts +0 -307
- package/dist/umd/mapGetAllEventsQueryEvents.d.ts +0 -3
- package/dist/umd/ordering.d.ts +0 -13
- package/dist/umd/pagination.d.ts +0 -65
- package/dist/umd/subgraph/SubgraphClient.d.ts +0 -16
- package/dist/umd/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +0 -45
- package/dist/umd/subgraph/queries/getAllEvents.generated.d.ts +0 -651
- package/dist/umd/subgraph/queries/getIndexSubscriptions.generated.d.ts +0 -46
- package/dist/umd/subgraph/queries/getIndexes.generated.d.ts +0 -44
- package/dist/umd/subgraph/queries/getStreams.generated.d.ts +0 -58
- package/dist/umd/subgraph/queries/getTokens.generated.d.ts +0 -27
- package/dist/umd/subgraph/schema.generated.d.ts +0 -6487
- package/dist/umd/typechain/ERC20WithTokenInfo.d.ts +0 -159
- package/dist/umd/typechain/IConstantFlowAgreementV1.d.ts +0 -305
- package/dist/umd/typechain/IInstantDistributionAgreementV1.d.ts +0 -585
- package/dist/umd/typechain/IResolver.d.ts +0 -57
- package/dist/umd/typechain/SuperToken.d.ts +0 -1011
- package/dist/umd/typechain/Superfluid.d.ts +0 -780
- package/dist/umd/typechain/SuperfluidLoader.d.ts +0 -55
- package/dist/umd/typechain/TestToken.d.ts +0 -207
- package/dist/umd/typechain/common.d.ts +0 -21
- package/dist/umd/typechain/factories/ERC20WithTokenInfo__factory.d.ts +0 -35
- package/dist/umd/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +0 -35
- package/dist/umd/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +0 -35
- package/dist/umd/typechain/factories/IResolver__factory.d.ts +0 -22
- package/dist/umd/typechain/factories/SuperToken__factory.d.ts +0 -46
- package/dist/umd/typechain/factories/SuperfluidLoader__factory.d.ts +0 -37
- package/dist/umd/typechain/factories/Superfluid__factory.d.ts +0 -82
- package/dist/umd/typechain/factories/TestToken__factory.d.ts +0 -46
- package/dist/umd/types.d.ts +0 -2
- package/dist/umd/utils.d.ts +0 -89
- package/dist/umd/validation.d.ts +0 -8
package/README.md
CHANGED
|
@@ -37,12 +37,24 @@ yarn install && yarn build
|
|
|
37
37
|
|
|
38
38
|
Here is a quick look at initializing the SDK in different environments:
|
|
39
39
|
|
|
40
|
-
TypeScript / JavaScript (Module)
|
|
40
|
+
TypeScript / JavaScript (Module) vs. JavaScript (CommonJS) - usually a Node.js environment
|
|
41
41
|
|
|
42
|
+
The primary difference between the two environments is the import/require of the sdk-core package, everything else is the same.
|
|
43
|
+
|
|
44
|
+
TS/ESModule
|
|
42
45
|
```ts
|
|
43
46
|
import { Framework } from "@superfluid-finance/sdk-core";
|
|
44
47
|
import { ethers } from "ethers";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
CommonJS/Node.js
|
|
51
|
+
```js
|
|
52
|
+
const { Framework } = require("@superfluid-finance/sdk-core");
|
|
53
|
+
const { ethers } = require("ethers");
|
|
54
|
+
```
|
|
45
55
|
|
|
56
|
+
```ts
|
|
57
|
+
// infura provider initialization
|
|
46
58
|
const provider = new ethers.providers.InfuraProvider(
|
|
47
59
|
"matic",
|
|
48
60
|
"<INFURA_API_KEY>"
|
|
@@ -60,31 +72,73 @@ const web3jsSf = await Framework.create({
|
|
|
60
72
|
networkName: "matic",
|
|
61
73
|
provider: web3jsProvider
|
|
62
74
|
});
|
|
63
|
-
```
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
// injected web3.js initialization (Hardhat)
|
|
77
|
+
// most likely to be used on backend for testing
|
|
78
|
+
// NOTE: if you're using truffle, you should be able to
|
|
79
|
+
// omit the (global as any) as this should be
|
|
80
|
+
// exposed already (in JS at least)
|
|
81
|
+
const injectedWeb3jsSf = await Framework.create({
|
|
82
|
+
networkName: "custom",
|
|
83
|
+
provider: (global as any).web3,
|
|
84
|
+
dataMode: "WEB3_ONLY",
|
|
85
|
+
resolverAddress: <RESOLVER_ADDRESS>,
|
|
86
|
+
protocolReleaseVersion: "test",
|
|
87
|
+
});
|
|
66
88
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
// injected hardhat ethers initialization
|
|
90
|
+
// most likely to be used on backend for testing
|
|
91
|
+
import hardhat from "hardhat";
|
|
92
|
+
const injectedHardhatEthersSf = await Framework.create({
|
|
93
|
+
networkName: "custom",
|
|
94
|
+
provider: hardhat.ethers,
|
|
95
|
+
dataMode: "WEB3_ONLY",
|
|
96
|
+
resolverAddress: <RESOLVER_ADDRESS>,
|
|
97
|
+
protocolReleaseVersion: "test",
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
// ethers.js + hardhat provider initialization (in testing environment w/ hardhat-ethers)
|
|
101
|
+
import { ethers } from "hardhat";
|
|
102
|
+
const [deployer] = await ethers.getSigners();
|
|
103
|
+
const ethersProvider = deployer.provider;
|
|
104
|
+
const ethersjsSf = await Framework.create({
|
|
105
|
+
networkName: "custom",
|
|
106
|
+
dataMode: "WEB3_ONLY",
|
|
107
|
+
resolverAddress: <RESOLVER_ADDRESS>,
|
|
108
|
+
protocolReleaseVersion: "test",
|
|
109
|
+
provider: ethersProvider
|
|
110
|
+
});
|
|
70
111
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
const sf = await Framework.create({
|
|
112
|
+
// metamask
|
|
113
|
+
const mmProvider = new ethers.providers.Web3Provider(window.ethereum);
|
|
114
|
+
const mmSf = await Framework.create({
|
|
76
115
|
networkName: "matic",
|
|
77
|
-
provider
|
|
116
|
+
provider: mmProvider
|
|
78
117
|
});
|
|
79
118
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const web3jsSf = await Framework.create({
|
|
119
|
+
// web3modal
|
|
120
|
+
const web3ModalRawProvider = await web3Modal.connect();
|
|
121
|
+
const web3ModalProvider = new ethers.providers.Web3Provider(web3ModalRawProvider);
|
|
122
|
+
const web3ModalSf = await Framework.create({
|
|
85
123
|
networkName: "matic",
|
|
86
|
-
provider:
|
|
124
|
+
provider: web3ModalProvider
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
//bnc-onboard
|
|
128
|
+
const onboard = Onboard({
|
|
129
|
+
dappId: "<API_KEY>",
|
|
130
|
+
networkId: 4,
|
|
131
|
+
subscriptions: {
|
|
132
|
+
wallet: wallet => {
|
|
133
|
+
const web3Provider = new ethers.providers.Web3Provider(wallet.provider);
|
|
134
|
+
(async () => {
|
|
135
|
+
const framework = await Framework.create({ networkName: "matic", provider: web3Provider });
|
|
136
|
+
})();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
87
139
|
});
|
|
140
|
+
// this is triggered by:
|
|
141
|
+
await onboard.walletSelect();
|
|
88
142
|
```
|
|
89
143
|
|
|
90
144
|
> Note: You specify your project type in `package.json` - `"type": "module"` or `"type": "commonjs"`.
|
|
@@ -116,12 +170,50 @@ const sf = await Framework.create({
|
|
|
116
170
|
provider
|
|
117
171
|
});
|
|
118
172
|
|
|
173
|
+
type Paging = { take: number, skip?: number, lastId?: string };
|
|
174
|
+
|
|
119
175
|
const pageResult = await sf.query.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
176
|
+
listAllResults(paging: Paging);
|
|
177
|
+
|
|
178
|
+
// The different queries can take different order by properties
|
|
179
|
+
// given the properties that exist on the entity itself.
|
|
180
|
+
listAllSuperTokens({ isListed?: boolean },
|
|
181
|
+
paging: Paging,
|
|
182
|
+
ordering: Ordering<Token_OrderBy>
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
listIndexes({ indexId?: string, publisher?: string, token?: string },
|
|
186
|
+
paging: Paging,
|
|
187
|
+
ordering: Ordering<Index_OrderBy>
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
listIndexSubscriptions({ subscriber?: string, approved?: boolean },
|
|
191
|
+
paging: Paging,
|
|
192
|
+
ordering: Ordering<IndexSubscription_OrderBy>
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
listStreams({ sender?: string, receiver?: string, token?: string },
|
|
196
|
+
paging: Paging,
|
|
197
|
+
ordering: Ordering<Stream_OrderBy>
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
listUserInteractedSuperTokens({ account?: string, token?: string },
|
|
201
|
+
paging: Paging,
|
|
202
|
+
ordering: Ordering<AccountTokenSnapshot_OrderBy>
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
listEvents({ account?: string, timestamp_gt?: number },
|
|
206
|
+
paging: Paging,
|
|
207
|
+
ordering: Ordering<Event_OrderBy>
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
// A subscription function which allows you to subscribe to events via polling.
|
|
211
|
+
on(
|
|
212
|
+
callback: (events: AllEvents[], unsubscribe: () => void) => void,
|
|
213
|
+
ms: number,
|
|
214
|
+
account?: string,
|
|
215
|
+
timeout?: number
|
|
216
|
+
)
|
|
125
217
|
```
|
|
126
218
|
|
|
127
219
|
#### Direct Initialization
|
|
@@ -130,17 +222,45 @@ If you'd like, you can also initialize the `Query` class as a standalone class l
|
|
|
130
222
|
|
|
131
223
|
```ts
|
|
132
224
|
import { Query } from "@superfluid-finance/sdk-core";
|
|
133
|
-
const query = new Query({
|
|
134
|
-
|
|
135
|
-
|
|
225
|
+
const query = new Query({
|
|
226
|
+
customSubgraphQueriesEndpoint: "<A_CUSTOM_ENDPOINT>",
|
|
227
|
+
dataMode: "SUBGRAPH_ONLY" | "SUBGRAPH_WEB3" | "WEB3_ONLY"
|
|
228
|
+
});
|
|
136
229
|
```
|
|
137
230
|
|
|
138
231
|
#### Pagination
|
|
139
232
|
|
|
140
|
-
All of the pre-defined query functions will accept pagination options: `({ skip: number, take: number })`, if you don't pass anything in, it will use a default of: `{ skip: 0, take: 100 }`.
|
|
233
|
+
All of the pre-defined query functions will accept pagination options: `({ skip: number, take: number })`, if you don't pass anything in, it will use a default of: `{ skip: 0, take: 100 }`. You can also paginate by `lastId`, this allows you to bypass the limitation of the max skip of 5000 entities.
|
|
141
234
|
|
|
142
235
|
> Note: this example uses the `graphql-request` library, but you just need to provide a valid query which is a string.
|
|
143
236
|
|
|
237
|
+
#### Ordering
|
|
238
|
+
|
|
239
|
+
You can also pass in an ordering object for the different queries, each query function will accept different ordering properties depending on the properties on the entity. We have different defaults for each so you don't need to actually pass anything in.
|
|
240
|
+
|
|
241
|
+
#### Example Usage
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
const { Framework } = require("@superfluid-finance/sdk-core");
|
|
245
|
+
const { ethers } = require("ethers");
|
|
246
|
+
|
|
247
|
+
const provider = new ethers.providers.InfuraProvider(
|
|
248
|
+
"matic",
|
|
249
|
+
"<INFURA_API_KEY>"
|
|
250
|
+
);
|
|
251
|
+
const sf = await Framework.create({
|
|
252
|
+
networkName: "matic",
|
|
253
|
+
provider
|
|
254
|
+
});
|
|
255
|
+
const results = await sf.query.listAllSuperTokens(
|
|
256
|
+
{ isListed: true },
|
|
257
|
+
{ skip: 5, take: 150 },
|
|
258
|
+
{
|
|
259
|
+
orderBy: "createdAtBlockNumber",
|
|
260
|
+
orderDirection: "desc"
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
144
264
|
### Creating a Signer
|
|
145
265
|
|
|
146
266
|
In order to execute a transaction on the blockchain, you need to have a signer. That is, you need to have access to an EOA (Externally Owned Account) to trigger any sort of change. You can do this through a contract, but an EOA still has to be the one which triggers the contract to interact with another contract. The signer that is returned will be passed when executing transactions.
|
|
@@ -163,11 +283,11 @@ const sf = await Framework.create({
|
|
|
163
283
|
provider: web3ModalProvider,
|
|
164
284
|
});
|
|
165
285
|
|
|
166
|
-
const web3ModalSigner = sf.createSigner(web3ModalProvider);
|
|
286
|
+
const web3ModalSigner = sf.createSigner({ web3Provider: web3ModalProvider });
|
|
167
287
|
|
|
168
288
|
// MetaMask example
|
|
169
289
|
const metamaskProvider = new Web3Provider(window.ethereum);
|
|
170
|
-
const metaMaskSigner = sf.createSigner(metamaskProvider);
|
|
290
|
+
const metaMaskSigner = sf.createSigner({ web3Provider: metamaskProvider });
|
|
171
291
|
```
|
|
172
292
|
|
|
173
293
|
#### Hardhat Signer Example
|
|
@@ -212,9 +332,7 @@ const sf = await Framework.create({
|
|
|
212
332
|
provider,
|
|
213
333
|
});
|
|
214
334
|
|
|
215
|
-
const signer = sf.createSigner({
|
|
216
|
-
signer: wallet
|
|
217
|
-
});
|
|
335
|
+
const signer = sf.createSigner({ signer: wallet });
|
|
218
336
|
```
|
|
219
337
|
|
|
220
338
|
### Operation
|
|
@@ -278,15 +396,88 @@ const cfaV1 = new ConstantFlowAgreementV1({ options: config });
|
|
|
278
396
|
|
|
279
397
|
#### CFAV1 Functions
|
|
280
398
|
```ts
|
|
281
|
-
//
|
|
282
|
-
await sf.cfaV1.getFlow({
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
await sf.cfaV1.
|
|
399
|
+
// Read functions
|
|
400
|
+
await sf.cfaV1.getFlow({
|
|
401
|
+
superToken: string,
|
|
402
|
+
sender: string,
|
|
403
|
+
receiver: string,
|
|
404
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
await sf.cfaV1.getAccountFlowInfo({
|
|
408
|
+
superToken: string,
|
|
409
|
+
account: string,
|
|
410
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
await sf.cfaV1.getNetFlow({
|
|
414
|
+
superToken: string,
|
|
415
|
+
account: string,
|
|
416
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
// Write operations
|
|
421
|
+
sf.cfaV1.createFlow({
|
|
422
|
+
sender: string,
|
|
423
|
+
receiver: string,
|
|
424
|
+
token: string,
|
|
425
|
+
flowRate: string,
|
|
426
|
+
userData?: string
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
sf.cfaV1.updateFlow({
|
|
430
|
+
sender: string,
|
|
431
|
+
receiver: string,
|
|
432
|
+
token: string,
|
|
433
|
+
flowRate: string,
|
|
434
|
+
userData?: string
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
sf.cfaV1.deleteFlow({
|
|
438
|
+
sender: string,
|
|
439
|
+
receiver: string,
|
|
440
|
+
token: string,
|
|
441
|
+
userData?: string
|
|
442
|
+
});
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
#### Example Usage
|
|
446
|
+
|
|
447
|
+
```ts
|
|
448
|
+
import { Framework } from "@superfluid-finance/sdk-core";
|
|
449
|
+
import { ethers } from "ethers";
|
|
450
|
+
|
|
451
|
+
const provider = new ethers.providers.InfuraProvider(
|
|
452
|
+
"matic",
|
|
453
|
+
"<INFURA_API_KEY>"
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
const sf = await Framework.create({
|
|
457
|
+
networkName: "matic",
|
|
458
|
+
provider
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// Read example
|
|
462
|
+
const flowInfo = await sf.cfaV1.getFlow({
|
|
463
|
+
superToken: "0x...",
|
|
464
|
+
sender: "0x...",
|
|
465
|
+
receiver: "0x...",
|
|
466
|
+
providerOrSigner: provider
|
|
467
|
+
});
|
|
468
|
+
console.log("flowInfo", flowInfo);
|
|
469
|
+
|
|
470
|
+
// Write operation example
|
|
471
|
+
const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
|
|
472
|
+
const createFlowOperation = sf.cfaV1.createFlow({
|
|
473
|
+
sender: "0x...",
|
|
474
|
+
receiver: "0x...",
|
|
475
|
+
token: "0x...",
|
|
476
|
+
flowRate: "1000000000"
|
|
477
|
+
});
|
|
478
|
+
const txnResponse = await createFlowOperation.exec(signer);
|
|
479
|
+
const txnReceipt = await txnResponse.wait();
|
|
480
|
+
// Transaction Complete when code reaches here
|
|
290
481
|
```
|
|
291
482
|
|
|
292
483
|
### InstantDistributionAgreementV1
|
|
@@ -310,19 +501,110 @@ const idaV1 = new InstantDistributionAgreementV1({ options: config });
|
|
|
310
501
|
|
|
311
502
|
#### IDAV1 Functions
|
|
312
503
|
```ts
|
|
313
|
-
//
|
|
314
|
-
await sf.idaV1.getSubscription({
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
await sf.idaV1.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
504
|
+
// Read functions
|
|
505
|
+
await sf.idaV1.getSubscription({
|
|
506
|
+
superToken: string,
|
|
507
|
+
publisher: string,
|
|
508
|
+
indexId: string,
|
|
509
|
+
subscriber: string,
|
|
510
|
+
providerOrSigner: string
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
await sf.idaV1.getIndex({
|
|
514
|
+
superToken: string,
|
|
515
|
+
publisher: string,
|
|
516
|
+
indexId: string,
|
|
517
|
+
providerOrSigner: string
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
// Write operations
|
|
522
|
+
sf.idaV1.createIndex({
|
|
523
|
+
indexId: string,
|
|
524
|
+
superToken: string,
|
|
525
|
+
userData?: string
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
sf.idaV1.distribute({
|
|
529
|
+
indexId: string,
|
|
530
|
+
superToken: string,
|
|
531
|
+
amount: string,
|
|
532
|
+
userData?: string
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
sf.idaV1.updateIndexValue({
|
|
536
|
+
indexId: string,
|
|
537
|
+
superToken: string,
|
|
538
|
+
indexValue: string,
|
|
539
|
+
userData?: string
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
sf.idaV1.updateSubscriptionUnits({
|
|
543
|
+
indexId: string,
|
|
544
|
+
superToken: string,
|
|
545
|
+
subscriber: string,
|
|
546
|
+
units: string,
|
|
547
|
+
userData?: string
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
sf.idaV1.approveSubscription({
|
|
551
|
+
indexId: string,
|
|
552
|
+
superToken: string,
|
|
553
|
+
publisher: string,
|
|
554
|
+
userData?: string
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
sf.idaV1.revokeSubscription({
|
|
558
|
+
indexId: string,
|
|
559
|
+
superToken: string,
|
|
560
|
+
publisher: string,
|
|
561
|
+
userData?: string
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
sf.idaV1.deleteSubscription({
|
|
565
|
+
indexId: string,
|
|
566
|
+
superToken: string,
|
|
567
|
+
subscriber: string,
|
|
568
|
+
publisher: string,
|
|
569
|
+
userData?: string
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
sf.idaV1.claim({
|
|
573
|
+
indexId: string,
|
|
574
|
+
superToken: string,
|
|
575
|
+
subscriber: string,
|
|
576
|
+
publisher: string,
|
|
577
|
+
userData?: string
|
|
578
|
+
});
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
#### Example Usage
|
|
582
|
+
|
|
583
|
+
```ts
|
|
584
|
+
import { Framework } from "@superfluid-finance/sdk-core";
|
|
585
|
+
import { ethers } from "ethers";
|
|
586
|
+
|
|
587
|
+
const provider = new ethers.providers.InfuraProvider(
|
|
588
|
+
"matic",
|
|
589
|
+
"<INFURA_API_KEY>"
|
|
590
|
+
);
|
|
591
|
+
|
|
592
|
+
const sf = await Framework.create({
|
|
593
|
+
networkName: "matic",
|
|
594
|
+
provider
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// Read example
|
|
598
|
+
const subscription = await sf.idaV1.getSubscription({ superToken: "0x...", publisher: "0x...", indexId: "1", subscriber: "0x...", providerOrSigner: provider });
|
|
599
|
+
console.log(subscription);
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
// Write operation example
|
|
603
|
+
const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
|
|
604
|
+
const createIndexOperation = sf.idaV1.createIndex({ indexId: "0", userData: "0x" });
|
|
605
|
+
const txnResponse = await createIndexOperation.exec(signer);
|
|
606
|
+
const txnReceipt = await txnResponse.wait();
|
|
607
|
+
// Transaction Complete when code reaches here
|
|
326
608
|
```
|
|
327
609
|
|
|
328
610
|
### SuperToken
|
|
@@ -358,7 +640,6 @@ const provider = new ethers.providers.InfuraProvider(
|
|
|
358
640
|
"matic",
|
|
359
641
|
"<INFURA_API_KEY>"
|
|
360
642
|
);
|
|
361
|
-
let usdcx: SuperToken;
|
|
362
643
|
|
|
363
644
|
const config = {
|
|
364
645
|
hostAddress: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7",
|
|
@@ -367,7 +648,7 @@ const config = {
|
|
|
367
648
|
idaV1Address: "0xB0aABBA4B2783A72C52956CDEF62d438ecA2d7a1"
|
|
368
649
|
};
|
|
369
650
|
|
|
370
|
-
usdcx = await SuperToken.create({
|
|
651
|
+
const usdcx = await SuperToken.create({
|
|
371
652
|
address: "0xCAa7349CEA390F89641fe306D93591f87595dc1F",
|
|
372
653
|
config,
|
|
373
654
|
networkName: "matic",
|
|
@@ -380,32 +661,103 @@ usdcx = await SuperToken.create({
|
|
|
380
661
|
```ts
|
|
381
662
|
const usdcx = sf.loadToken("0xCAa7349CEA390F89641fe306D93591f87595dc1F");
|
|
382
663
|
|
|
383
|
-
//
|
|
384
|
-
//
|
|
385
|
-
await usdcx.balanceOf({
|
|
386
|
-
|
|
387
|
-
|
|
664
|
+
// ERC20 `Token`
|
|
665
|
+
// Read functions
|
|
666
|
+
await usdcx.balanceOf({
|
|
667
|
+
account: string,
|
|
668
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
await usdcx.allowance({
|
|
672
|
+
owner: string,
|
|
673
|
+
spender: string,
|
|
674
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
await usdcx.name({
|
|
678
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
await usdcx.symbol({
|
|
682
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
await usdcx.totalSupply({
|
|
686
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
// Write operations
|
|
691
|
+
usdcx.approve({
|
|
692
|
+
recipient: string,
|
|
693
|
+
amount: string
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
usdcx.transfer({
|
|
697
|
+
recipient: string,
|
|
698
|
+
amount: string
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
usdcx.transferFrom({
|
|
702
|
+
sender: string,
|
|
703
|
+
recipient: string,
|
|
704
|
+
amount: string
|
|
705
|
+
});
|
|
388
706
|
|
|
389
707
|
// `SuperToken` only function
|
|
390
|
-
await usdcx.realtimeBalanceOf({
|
|
708
|
+
await usdcx.realtimeBalanceOf({
|
|
709
|
+
account: string,
|
|
710
|
+
timestamp: string,
|
|
711
|
+
providerOrSigner: ethers.providers.Provider | ethers.Signer
|
|
712
|
+
});
|
|
391
713
|
|
|
392
714
|
// Write Functions
|
|
715
|
+
|
|
393
716
|
// All write functions return Promise<Operation>
|
|
394
717
|
|
|
395
|
-
// SuperToken Write
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
await usdcx.transferFrom({ sender: string, recipient: string, amount: string });
|
|
400
|
-
await usdcx.upgrade({ amount: string });
|
|
718
|
+
// SuperToken Write operations
|
|
719
|
+
usdcx.downgrade({ amount: string });
|
|
720
|
+
|
|
721
|
+
usdcx.upgrade({ amount: string });
|
|
401
722
|
|
|
402
723
|
// SuperToken CFAV1/IDAV1 Functions are the same as the
|
|
403
724
|
// ConstantFlowAgreementV1/InstantDistributionAgreementV1 class functions
|
|
404
725
|
// except instead of the sf.cfaV1/idaV1.function() signature, it is token.function()
|
|
726
|
+
// e.g. await usdcx.createIndex({ indexId: "0", userData: "0x" }).exec(signer);
|
|
405
727
|
// and you don't need to pass in a token as a parameter as it uses the token address
|
|
406
728
|
// of the instantiated class.
|
|
407
729
|
```
|
|
408
730
|
|
|
731
|
+
#### Example Usage
|
|
732
|
+
|
|
733
|
+
```ts
|
|
734
|
+
import { Framework } from "@superfluid-finance/sdk-core";
|
|
735
|
+
import { ethers } from "ethers";
|
|
736
|
+
|
|
737
|
+
const provider = new ethers.providers.InfuraProvider(
|
|
738
|
+
"matic",
|
|
739
|
+
"<INFURA_API_KEY>"
|
|
740
|
+
);
|
|
741
|
+
|
|
742
|
+
const sf = await Framework.create({
|
|
743
|
+
networkName: "matic",
|
|
744
|
+
provider
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
const usdcx = sf.loadToken("0xCAa7349CEA390F89641fe306D93591f87595dc1F");
|
|
748
|
+
|
|
749
|
+
// Read example
|
|
750
|
+
const name = await usdcx.name();
|
|
751
|
+
console.log(name);
|
|
752
|
+
|
|
753
|
+
// Write operation example
|
|
754
|
+
const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
|
|
755
|
+
const transferOperation = usdcx.transfer({ receiver: "0x...", amount: "1000000" });
|
|
756
|
+
const txnResponse = await transferOperation.exec(signer);
|
|
757
|
+
const txnReceipt = await txnResponse.wait();
|
|
758
|
+
// Transaction Complete when code reaches here
|
|
759
|
+
```
|
|
760
|
+
|
|
409
761
|
> Note: you can also get the underlying Token object which only has ERC20 token read/write methods-this is useful for things like approving token spend to a SuperToken contract prior to upgrading for example.
|
|
410
762
|
|
|
411
763
|
```ts
|
|
@@ -421,12 +773,12 @@ The `BatchCall` class allows the user to batch multiple supported operations/tra
|
|
|
421
773
|
|
|
422
774
|
Not all operations are supported by the batch call feature, below is a list of the supported operations:
|
|
423
775
|
|
|
424
|
-
- ERC20_APPROVE (SuperToken only)
|
|
425
|
-
- ERC20_TRANSFER_FROM
|
|
426
|
-
- SUPERTOKEN_UPGRADE
|
|
427
|
-
- SUPERTOKEN_DOWNGRADE
|
|
428
|
-
- SUPERFLUID_CALL_AGREEMENT
|
|
429
|
-
- CALL_APP_ACTION
|
|
776
|
+
- `ERC20_APPROVE (SuperToken only)`
|
|
777
|
+
- `ERC20_TRANSFER_FROM`
|
|
778
|
+
- `SUPERTOKEN_UPGRADE`
|
|
779
|
+
- `SUPERTOKEN_DOWNGRADE`
|
|
780
|
+
- `SUPERFLUID_CALL_AGREEMENT`
|
|
781
|
+
- `CALL_APP_ACTION`
|
|
430
782
|
|
|
431
783
|
Most of the token methods are self explanatory, but some additional context for the last two operations is helpful.
|
|
432
784
|
`SUPERFLUID_CALL_AGREEMENT` refers to all operations related to the CFA or IDA (`createFlow`, `updateIndex`, `distribute`, etc.).
|
|
@@ -473,7 +825,32 @@ const batchCall = new BatchCall({
|
|
|
473
825
|
#### Usage
|
|
474
826
|
|
|
475
827
|
```ts
|
|
476
|
-
|
|
828
|
+
import { Framework } from "@superfluid-finance/sdk-core";
|
|
829
|
+
import { ethers } from "ethers";
|
|
830
|
+
|
|
831
|
+
const provider = new ethers.providers.InfuraProvider(
|
|
832
|
+
"matic",
|
|
833
|
+
"<INFURA_API_KEY>"
|
|
834
|
+
);
|
|
835
|
+
|
|
836
|
+
const sf = await Framework.create({
|
|
837
|
+
networkName: "matic",
|
|
838
|
+
provider
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
// 0xabc is the signer on Rinkeby testnet
|
|
842
|
+
const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
|
|
843
|
+
const daix = await sf.loadSuperToken("0x745861AeD1EEe363b4AaA5F1994Be40b1e05Ff90");
|
|
844
|
+
const fromAddress = "0xabc";
|
|
845
|
+
const paymentAddress = "0xdef";
|
|
846
|
+
const approveOp = daix.approve({ receiver: paymentAddress, amount: "10000" });
|
|
847
|
+
const transferFromOp = daix.transferFrom({
|
|
848
|
+
sender: fromAddress,
|
|
849
|
+
receiver: paymentAddress,
|
|
850
|
+
amount: "10000",
|
|
851
|
+
});
|
|
852
|
+
const batchCall = sf.batchCall([approveOp, transferFromOp]);
|
|
853
|
+
const txn = await batchCall.exec(signer);
|
|
477
854
|
|
|
478
855
|
// creating an operation from a super app function
|
|
479
856
|
// initialize your super app contract
|
|
@@ -483,5 +860,5 @@ const superApp = new ethers.Contract("0x...", <SUPER_APP_ABI>);
|
|
|
483
860
|
const superAppTransactionPromise = superApp.populateTransaction.helloWorld("hello world");
|
|
484
861
|
|
|
485
862
|
// create the super app operation you can execute this operation directly or pass it in to a batch call
|
|
486
|
-
const superAppOperation = new Operation(
|
|
863
|
+
const superAppOperation = new Operation(superAppTransactionPromise, "CALL_APP_ACTION");
|
|
487
864
|
```
|