From d9a672a2b35d692b1d56c3c0d83ee5af175b1ef9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:36:39 +0000 Subject: [PATCH] chore: bump @iota/sdk from 1.0.9 to 1.1.0 in /packages/shared (#872) * chore: bump @iota/sdk from 1.0.9 to 1.1.0 in /packages/shared Bumps [@iota/sdk](https://github.com/iotaledger/iota-sdk) from 1.0.9 to 1.1.0. - [Release notes](https://github.com/iotaledger/iota-sdk/releases) - [Changelog](https://github.com/iotaledger/iota-sdk/blob/develop/CHANGELOG.md) - [Commits](https://github.com/iotaledger/iota-sdk/compare/iota-sdk-nodejs-v1.0.9...cli-wallet-v1.1.0) --- updated-dependencies: - dependency-name: "@iota/sdk" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * chore: update yarn.lock * chore: update account interface with new methods * feat: use backend filter --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> Co-authored-by: Tuditi --- packages/shared/package.json | 2 +- .../account/interfaces/account.interface.ts | 11 +++++ .../nfts/actions/loadNftsForActiveProfile.ts | 8 ++-- packages/shared/test/mocks/account.mock.ts | 44 +++++++++++++++++++ yarn.lock | 8 ++-- 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/packages/shared/package.json b/packages/shared/package.json index 75ef932ab0..7f0259d78e 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -13,7 +13,7 @@ "@iota/transaction-converter": "1.0.0-beta.30", "@iota/unit-converter": "1.0.0-beta.30", "@iota/util.js": "2.0.0-rc.2", - "@iota/sdk": "1.0.9", + "@iota/sdk": "1.1.0", "@sveltejs/svelte-virtual-list": "3.0.1", "@walletconnect/jsonrpc-types": "1.0.3", "@walletconnect/types": "2.9.0", diff --git a/packages/shared/src/lib/core/account/interfaces/account.interface.ts b/packages/shared/src/lib/core/account/interfaces/account.interface.ts index 23c8b1faf3..a7d0ca3016 100644 --- a/packages/shared/src/lib/core/account/interfaces/account.interface.ts +++ b/packages/shared/src/lib/core/account/interfaces/account.interface.ts @@ -31,6 +31,7 @@ import type { SendParams, SignedTransactionEssence, SyncOptions, + TokenId, Transaction, TransactionOptions, } from '@iota/sdk' @@ -38,8 +39,12 @@ import type { export interface IAccount { addresses(): Promise addressesWithUnspentOutputs(): Promise + burn(burn: Burn, transactionOptions?: TransactionOptions): Promise + consolidateOutputs(params: ConsolidationParams): Promise claimableOutputs(outputs: OutputsToClaim): Promise claimOutputs(outputIds: string[]): Promise + createAliasOutput(params?: AliasOutputParams, transactionOptions?: TransactionOptions): Promise + createNativeToken(params: CreateNativeTokenParams, transactionOptions?: TransactionOptions): Promise deregisterParticipationEvent(eventId: string): Promise generateEd25519Addresses(amount: number, options?: GenerateAddressOptions): Promise getBalance(): Promise @@ -55,6 +60,9 @@ export interface IAccount { getTransaction(transactionId: string): Promise incomingTransactions(): Promise outputs(filterOptions?: FilterOptions): Promise + meltNativeToken(tokenId: TokenId, meltAmount: bigint, transactionOptions?: TransactionOptions): Promise + mintNativeToken(tokenId: TokenId, mintAmount: bigint, transactionOptions?: TransactionOptions): Promise + mintNfts(params: MintNftParams[], transactionOptions?: TransactionOptions): Promise pendingTransactions(): Promise prepareBurn(burn: Burn, transactionOptions?: TransactionOptions): Promise prepareBurnNativeToken( @@ -102,6 +110,9 @@ export interface IAccount { requestFundsFromFaucet(url: string, address: string): Promise send(amount: bigint | string, address: string, transactionOptions?: TransactionOptions): Promise sendOutputs(outputs: Output[], transactionOptions?: TransactionOptions): Promise + sendNativeTokens(params: SendNativeTokensParams[], transactionOptions?: TransactionOptions): Promise + sendTransaction(outputs: Output[], options?: TransactionOptions): Promise + sendNft(params: SendNftParams[], transactionOptions?: TransactionOptions): Promise sendWithParams(params: SendParams[], transactionOptions?: TransactionOptions): Promise setAlias(alias: string): Promise setDefaultSyncOptions(options: SyncOptions): Promise diff --git a/packages/shared/src/lib/core/nfts/actions/loadNftsForActiveProfile.ts b/packages/shared/src/lib/core/nfts/actions/loadNftsForActiveProfile.ts index 1e76f1c08f..0fa18f95b6 100644 --- a/packages/shared/src/lib/core/nfts/actions/loadNftsForActiveProfile.ts +++ b/packages/shared/src/lib/core/nfts/actions/loadNftsForActiveProfile.ts @@ -25,10 +25,10 @@ async function loadNftsForAccount(account: IAccountState): Promise { } } - const allOutputs = await account.outputs() - const sortedNftOutputs = allOutputs - .filter((output) => output.output.type === OutputType.Nft) - .sort((a, b) => b.metadata.milestoneTimestampBooked - a.metadata.milestoneTimestampBooked) + const nftOutputs = await account.outputs({ outputTypes: [OutputType.Nft] }) + const sortedNftOutputs = nftOutputs.sort( + (a, b) => b.metadata.milestoneTimestampBooked - a.metadata.milestoneTimestampBooked + ) for (const outputData of sortedNftOutputs) { if (outputData.output.type === OutputType.Nft) { const nftOutput = outputData.output as NftOutput diff --git a/packages/shared/test/mocks/account.mock.ts b/packages/shared/test/mocks/account.mock.ts index 37bed07e92..bb3f1f715e 100644 --- a/packages/shared/test/mocks/account.mock.ts +++ b/packages/shared/test/mocks/account.mock.ts @@ -54,6 +54,10 @@ export class AccountMock implements IAccount { return Promise.resolve([]) } + burn(burn: Burn, transactionOptions?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + consolidateOutputs(params: ConsolidationParams): Promise { throw new Error('Method not implemented.') } @@ -66,6 +70,14 @@ export class AccountMock implements IAccount { throw new Error('Method not implemented.') } + createAliasOutput(params?: AliasOutputParams, transactionOptions?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + + createNativeToken(params: CreateNativeTokenParams, transactionOptions?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + deregisterParticipationEvent(eventId: string): Promise { throw new Error('Method not implemented.') } @@ -153,6 +165,26 @@ export class AccountMock implements IAccount { throw new Error('Method not implemented.') } + meltNativeToken( + tokenId: TokenId, + meltAmount: bigint, + transactionOptions?: TransactionOptions + ): Promise { + throw new Error('Method not implemented.') + } + + mintNativeToken( + tokenId: TokenId, + mintAmount: bigint, + transactionOptions?: TransactionOptions + ): Promise { + throw new Error('Method not implemented.') + } + + mintNfts(params: MintNftParams[], transactionOptions?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + outputs(filterOptions?: FilterOptions): Promise<[]> { return Promise.resolve([]) } @@ -278,6 +310,18 @@ export class AccountMock implements IAccount { throw new Error('Method not implemented.') } + sendNativeTokens(params: SendNativeTokensParams[], transactionOptions?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + + sendTransaction(outputs: Output[], options?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + + sendNft(params: SendNftParams[], transactionOptions?: TransactionOptions): Promise { + throw new Error('Method not implemented.') + } + sendOutputs(outputs: Output[], transactionOptions?: TransactionOptions): Promise { throw new Error('Method not implemented.') } diff --git a/yarn.lock b/yarn.lock index fcbcebf64b..569156c275 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1358,10 +1358,10 @@ resolved "https://registry.yarnpkg.com/@iota/pad/-/pad-1.0.0-beta.30.tgz#de19728f8f1b09c20e2365d0da34945006760082" integrity sha512-fnhPMPul18WunLq9Ni4rxzBFmhna6eaG8WroDg6GdQqSK/eN62uFHV8tpspJHXuCqwgCUVp6NpuUna7+B2OV9g== -"@iota/sdk@1.0.9": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@iota/sdk/-/sdk-1.0.9.tgz#5aa791b8dd28332fbf97f42dc9e53bc72cd3a435" - integrity sha512-7q/TGh0ABGu+wkhpjS/H7rNuKFwV+4ayDvTGvvdGu4C6o3siDFJkeYrMgbcsMq2O6qEN1w2TJnIE9BYl0yyz9A== +"@iota/sdk@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@iota/sdk/-/sdk-1.1.0.tgz#0566f80071abf6699febc57403a90146ddc8ebce" + integrity sha512-+sPYFPICCTk5/Gr+7nGUma2GWtd335g0CQyQcpALe1ivexn/HcuExwcMs4naJPx41/4f3WAD27cIHa59yIZrgA== dependencies: "@types/node" "^18.15.12" cargo-cp-artifact "^0.1.6"