Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alpha into beta (PolymeshAssociation#850)
* feat: 🎸 allow for exempted identities to be removed when a user does not pass exempted identities that are exempt when calling setTransferRestrictions the procedure will unset those permissions BREAKING CHANGE: 🧨 non passed exempted identities are removed when calling setTransferRestriction * refactor: 💡 fix code smells * test: 💍 add missing coverage * test: 💍 clean up test assertions for restrictions * test: 💍 add case for restriction type to stat type conversion * refactor: 💡 address pr comments * docs: ✏️ add comments to transformInput for set restrictions * refactor: 💡 use function for pushing exemption transactions * refactor: 💡 adjust exemption record structure * docs: ✏️ add comments to addExemptionIfNotPresent method * refactor: 💡 remove unused default * style: 💄 add line break after sizeOf definition * refactor: 💡 Make StatType internal as users never need it The stat type is inferred from the TransferRestrictionType they are interacting with. This eliminates the redundant StatisticsOpType and use StatType through out * docs: ✏️ add docs around StatType * refactor: 💡 address PR comments * refactor: 💡 use destructre for cleaner syntax * Beta into alpha (PolymeshAssociation#825) * docs: ✏️ update compatible version and docs url in readme.md * feat: 🎸 bump supported chain version to 5.0.2 * fix: 🐛 add warning to use the new npm repository * chore: 🤖 update references to use association signing managers * fix: 🐛 missing readme from npm * fix: 🐛 update polymathnetwork to association references (PolymeshAssociation#817) * Update README.md Co-authored-by: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com> * fix: 🐛 Fix inviteAccount method by updating the permission type (PolymeshAssociation#821) * fix: 🐛 Fix transfer with memo (PolymeshAssociation#822) use long type name when creating memos. Also replace lodash padEnd with the built in function Co-authored-by: Victor Vicente <VictorVicente@users.noreply.github.com> * Merge pull request PolymeshAssociation#818 from PolymeshAssociation/beta (PolymeshAssociation#824) Co-authored-by: Victor Vicente <VictorVicente@users.noreply.github.com> Co-authored-by: Victor <victor.g.vicente@gmail.com> Co-authored-by: Victor Vicente <VictorVicente@users.noreply.github.com> Co-authored-by: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com> * Feat/da 148 eliminate transaction queues (PolymeshAssociation#785) * feat: remove Transaction Queues The `TransactionQueue` class has been removed. Most of its methods have been moved over to `PolymeshTransaction` and `PolymeshTransactionBatch`. Methods that returned a `TransactionQueue` (all endpoints that write to the blockchain, such as `sdk.assets.registerTicker`) now return either a `PolymeshTransaction` or `PolymeshTransactionBatch`. This means that all operations in the SDK are now atomic and not prone to race conditions or half-states - The `onProcessedByMiddleware` method has been moved to `PolymeshTransaction` and `PolymeshTransactionBase` - The `Fees` interface now contains a `total` property which is the sum of `free` and `locked` - The `PayingAccountType` enum now includes a `Caller` member, to represent cases where the calling Account has to pay for a transaction’s fees BREAKING CHANGES: - Remove the `inputArgs` property from `PolymeshTransaction`. Replaced by the `args` property. Arguments for `PolymeshTransaction` and `PolymeshTransactionBatch` are now available at any point in time (previously they could depend on the result of a previous transaction in the queue) - Remove the `isCritical` property from both `PolymeshTransaction` and `PolymeshTransactionBatch`. It no longer makes sense without Transaction Queues - Change the `run` method in `PolymeshTransaction` and `PolymeshTransactionBatch` to work similarly to the `run` method in `TransactionQueue`. The method will check if the caller account has enough balance for fees, the transaction will be run and its status updated. The method returns a Promise that resolves to the result of running the transaction. For example, calling `run` on the transaction returned by `asset.registerTicker` will return a Promise that resolves to a `TickerReservation` entity - Change the argument received by the callback passed to `onStatusChange` to `PolymeshTransactionBase`. If type refinement is required, the `isPolymeshTransaction` and `isPolymeshTransactionBatch` typeguards can be used (they can be imported from `types`) - Change the return type of `getFees` in `PolymeshTransaction` and `PolymeshTransactionBatch` to `PayingAccountFees`, which contains details about the Account that will pay for the fees, its remaining balance (before paying), and the fees themselves - Remove the `getPayingAccount` method from `PolymeshTransaction` and `PolymeshTransactionBatch`. Its result is now contained in `getFees` - Change the `PayingAccount` type to now only contain `allowance: BigNumber` when `type` is `Subsidy`. For `Caller` and `Other`, there is no `allowance` * perf: ⚡️ use a single call to fetch latest finalized block * chore: 🤖 implement a way of discriminating batch events * feat: 🎸 Allow passing of `nonce` as part of `ProcedureOptions` * refactor: 💡 Remove unnecessary nonce value from txSpec * feat: 🎸 Add `currentNonce` method to `Account` * chore: 🤖 Allow async values for nonce * Update src/types/index.ts * feat: support merging transactions into batches - Add an `sdk.createTransactionBatch` endpoint that takes an array of SDK transactions and returns them all batched in a single transaction. The result of running this batch is an array of the results of each transaction in the same order - Fix documentation to reflect the fact that transaction queues no longer exist - Improve transaction fee calculation algorithm to avoid edge cases where estimated fees were different than the actual fees - Expose `getProtocolFees` from `PolymeshTransaction` and `PolymeshTransactionBatch` - Expose the `GenericPolymeshTransaction` type (returned by most endpoints that create transactions) BREAKING CHANGES: - Rename `getFees` to `getTotalFees` in `PolymeshTransaction` and `PolymeshTransactionBatch` * feat: 🎸 expose the `MapTxWithData` type * docs: ✏️ improve rendered documentation to handle code snippets * test: 💍 use proper type in assertion * feat: 🎸 support splitting batches Add a `splitTransactions` method to the `PolymeshTransactionBatch` class that returns all individual transactions in the batch. This method is useful when the caller is being subsidized, since batches do not support subsidies * fix: 🐛 carry manual fees over when simplifying a batch When a procedure that normally produces batches produced a single transaction, we weren't passing manual fee data over * test: 💍 polymathnetwork -> polymeshassociation in import path Co-authored-by: Prashant Bajpai <prashant.bajpai19@gmail.com> Co-authored-by: Victor Vicente <VictorVicente@users.noreply.github.com> Co-authored-by: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com> Co-authored-by: Eric <ericrichardson@polymath.network> * feat: 🎸 release elimination of transaction queues (PolymeshAssociation#828) triggers release of latest alpha as the previous merge had older commits skipped be semver bot Feat/da 148 eliminate transaction queues (PolymeshAssociation#785) * feat: remove Transaction Queues The `TransactionQueue` class has been removed. Most of its methods have been moved over to `PolymeshTransaction` and `PolymeshTransactionBatch`. Methods that returned a `TransactionQueue` (all endpoints that write to the blockchain, such as `sdk.assets.registerTicker`) now return either a `PolymeshTransaction` or `PolymeshTransactionBatch`. This means that all operations in the SDK are now atomic and not prone to race conditions or half-states - The `onProcessedByMiddleware` method has been moved to `PolymeshTransaction` and `PolymeshTransactionBase` - The `Fees` interface now contains a `total` property which is the sum of `free` and `locked` - The `PayingAccountType` enum now includes a `Caller` member, to represent cases where the calling Account has to pay for a transaction’s fees * perf: ⚡️ use a single call to fetch latest finalized block * chore: 🤖 implement a way of discriminating batch events * feat: 🎸 Allow passing of `nonce` as part of `ProcedureOptions` * refactor: 💡 Remove unnecessary nonce value from txSpec * feat: 🎸 Add `currentNonce` method to `Account` * chore: 🤖 Allow async values for nonce * Update src/types/index.ts * feat: support merging transactions into batches * feat: 🎸 expose the `MapTxWithData` type * docs: ✏️ improve rendered documentation to handle code snippets * test: 💍 use proper type in assertion * feat: 🎸 support splitting batches * fix: 🐛 carry manual fees over when simplifying a batch Add a `splitTransactions` method to the `PolymeshTransactionBatch` class that returns all individual transactions in the batch. This method is useful when the caller is being subsidized, since batches do not support subsidies When a procedure that normally produces batches produced a single transaction, we weren't passing manual fee data over - Add an `sdk.createTransactionBatch` endpoint that takes an array of SDK transactions and returns them all batched in a single transaction. The result of running this batch is an array of the results of each transaction in the same order - Fix documentation to reflect the fact that transaction queues no longer exist - Improve transaction fee calculation algorithm to avoid edge cases where estimated fees were different than the actual fees - Expose `getProtocolFees` from `PolymeshTransaction` and `PolymeshTransactionBatch` - Expose the `GenericPolymeshTransaction` type (returned by most endpoints that create transactions) BREAKING CHANGES: - Remove the `inputArgs` property from `PolymeshTransaction`. Replaced by the `args` property. Arguments for `PolymeshTransaction` and `PolymeshTransactionBatch` are now available at any point in time (previously they could depend on the result of a previous transaction in the queue) - Remove the `isCritical` property from both `PolymeshTransaction` and `PolymeshTransactionBatch`. It no longer makes sense without Transaction Queues - Change the `run` method in `PolymeshTransaction` and `PolymeshTransactionBatch` to work similarly to the `run` method in `TransactionQueue`. The method will check if the caller account has enough balance for fees, the transaction will be run and its status updated. The method returns a Promise that resolves to the result of running the transaction. For example, calling `run` on the transaction returned by `asset.registerTicker` will return a Promise that resolves to a `TickerReservation` entity - Change the argument received by the callback passed to `onStatusChange` to `PolymeshTransactionBase`. If type refinement is required, the `isPolymeshTransaction` and `isPolymeshTransactionBatch` typeguards can be used (they can be imported from `types`) - Change the return type of `getFees` in `PolymeshTransaction` and `PolymeshTransactionBatch` to `PayingAccountFees`, which contains details about the Account that will pay for the fees, its remaining balance (before paying), and the fees themselves - Remove the `getPayingAccount` method from `PolymeshTransaction` and `PolymeshTransactionBatch`. Its result is now contained in `getFees` - Change the `PayingAccount` type to now only contain `allowance: BigNumber` when `type` is `Subsidy`. For `Caller` and `Other`, there is no `allowance` - Rename `getFees` to `getTotalFees` in `PolymeshTransaction` and `PolymeshTransactionBatch` * feat: 🎸 use a more specific type for onStatusChange in txBase (PolymeshAssociation#829) use GenericPolymeshTransaction<ReturnValue, TransformedReturnValue> in onStatusChange handler defined in PolymeshTransactionBase. This makes it easier to define functions to be passed to it * chore: 🤖 improve typing around `assembleBatchTransaction` This reduces the need to use the `tuple` util, hopefully making the code a bit more idiomatic * fix: 🐛 fix bug where only the default signer was used (PolymeshAssociation#831) in Procedure `prepare` method, the passed in, non modified `context` was used, when `ctx` was supposed to be used instead * fix: 🐛 improve the typing of `splitTransactions` The original types weren't being properly reflected by the compiler, resulting in an array of only 2 transactions always. Also, when batching transactions that had a transformed return value, the compiler was throwing errors. Since we don't care about the original return value, only the transformed one, using `any` is acceptable * test: 💍 add missing coverage in setTransferRestriction also remove unnessesary type assertions in createMock functions * test: 💍 fix jest timer in PolymeshTransactionBase * refactor: 💡 remove redundant await * style: 💄 remove commented out code Co-authored-by: Victor Vicente <VictorVicente@users.noreply.github.com> Co-authored-by: Victor <victor.g.vicente@gmail.com> Co-authored-by: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com> Co-authored-by: Jeremías Díaz <monitz87@gmail.com> Co-authored-by: Prashant Bajpai <prashant.bajpai19@gmail.com>
- Loading branch information