Skip to content

Commit

Permalink
CSUB-882: rough draft of cc2 side of bridge (#1429)
Browse files Browse the repository at this point in the history
* rough draft of cc2 side of bridge

* updated imports

* Auto-update creditcoin-js type definitions

* added types to burn info and method signatures

* Auto-update creditcoin-js type definitions

* updated collector to be account id rather than external address

* Auto-update creditcoin-js type definitions

* changed balance to amount for burn info

* various cleanup fixes

* formatted

* added benchmarks for 2 burn extrinsics

* Auto-update creditcoin-js type definitions

---------

Co-authored-by: Zachary Frederick <zach.frederick@gluwa.com>
Co-authored-by: gluwa-bot <creditcoin@gluwa.com>
  • Loading branch information
3 people authored Nov 21, 2023
1 parent edc8998 commit 86c777d
Show file tree
Hide file tree
Showing 15 changed files with 517 additions and 316 deletions.
2 changes: 1 addition & 1 deletion creditcoin-js/creditcoin.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions creditcoin-js/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ declare module '@polkadot/api-base/types/errors' {
* The faucet has insufficient funds to complete this swap, please retry when the faucet has been reloaded
**/
BurnGATEInsufficientFaucetBalance: AugmentedError<ApiType>;
/**
* A call to burn specified more free funds than the account has access to
**/
BurnInsufficientFunds: AugmentedError<ApiType>;
/**
* During a call to burn or burn_all the settlement of the account balances failed
**/
BurnSettlementError: AugmentedError<ApiType>;
/**
* The coin collection has already been registered.
**/
Expand Down
1 change: 1 addition & 0 deletions creditcoin-js/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ declare module '@polkadot/api-base/types/events' {
* [bid_order_id, bid_order]
**/
BidOrderAdded: AugmentedEvent<ApiType, [PalletCreditcoinBidOrderId, PalletCreditcoinBidOrder]>;
Burned: AugmentedEvent<ApiType, [u64]>;
/**
* exchanging vested ERC-20 CC for native CC failed.
* [collected_coins_id, cause]
Expand Down
12 changes: 12 additions & 0 deletions creditcoin-js/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import type {
PalletCreditcoinAddress,
PalletCreditcoinAskOrder,
PalletCreditcoinBidOrder,
PalletCreditcoinBurnInfo,
PalletCreditcoinCleanupStorageCleanupState,
PalletCreditcoinCollectCoinsCollectedCoins,
PalletCreditcoinDealOrder,
Expand Down Expand Up @@ -334,6 +335,12 @@ declare module '@polkadot/api-base/types/storage' {
[u32, H256]
> &
QueryableStorageEntry<ApiType, [u32, H256]>;
burnedFunds: AugmentedQuery<
ApiType,
(arg: u64 | AnyNumber | Uint8Array) => Observable<Option<PalletCreditcoinBurnInfo>>,
[u64]
> &
QueryableStorageEntry<ApiType, [u64]>;
cleanupState: AugmentedQuery<
ApiType,
() => Observable<Option<PalletCreditcoinCleanupStorageCleanupState>>,
Expand All @@ -352,6 +359,11 @@ declare module '@polkadot/api-base/types/storage' {
[H256]
> &
QueryableStorageEntry<ApiType, [H256]>;
/**
* Counter for the related counted storage map
**/
counterForBurnedFunds: AugmentedQuery<ApiType, () => Observable<u32>, []> &
QueryableStorageEntry<ApiType, []>;
dealOrders: AugmentedQuery<
ApiType,
(
Expand Down
11 changes: 11 additions & 0 deletions creditcoin-js/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,17 @@ declare module '@polkadot/api-base/types/submittable' {
) => SubmittableExtrinsic<ApiType>,
[PalletCreditcoinAskOrderId, PalletCreditcoinBidOrderId, u32]
>;
burn: AugmentedSubmittable<
(
amount: u128 | AnyNumber | Uint8Array,
collector: AccountId32 | string | Uint8Array,
) => SubmittableExtrinsic<ApiType>,
[u128, AccountId32]
>;
burnAll: AugmentedSubmittable<
(collector: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>,
[AccountId32]
>;
/**
* Claims legacy wallet and transfers the balance to the sender's account.
**/
Expand Down
Loading

0 comments on commit 86c777d

Please sign in to comment.