Skip to content

Commit

Permalink
Update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Nov 27, 2023
1 parent 912e2d2 commit 1be3a57
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions bindings/nodejs/lib/types/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ export interface Balance {
requiredStorageDeposit: RequiredStorageDeposit;
/** The balance of the native tokens */
nativeTokens: NativeTokenBalance[];
/** Nft outputs */
nfts: string[];
/** Account outputs */
accounts: string[];
/** Foundry outputs */
foundries: string[];
/** Nft outputs */
nfts: string[];
/** Delegation outputs */
delegations: string[];
/**
* Outputs with multiple unlock conditions and if they can currently be spent or not. If there is a
* TimelockUnlockCondition or ExpirationUnlockCondition this can change at any time
Expand Down Expand Up @@ -64,6 +66,8 @@ export interface RequiredStorageDeposit {
foundry: u64;
/** The required amount for NFT outputs. */
nft: u64;
/** The required amount for Delegation outputs. */
delegation: u64;
}

/** The balance of a native token */
Expand Down
10 changes: 8 additions & 2 deletions bindings/python/iota_sdk/types/balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class RequiredStorageDeposit:
basic: The required amount for basic outputs.
foundry: The required amount for foundry outputs.
nft: The required amount for nft outputs.
delegation: The required amount for delegation outputs.
"""
account: int = field(metadata=config(
encoder=str
Expand All @@ -48,6 +49,9 @@ class RequiredStorageDeposit:
nft: int = field(metadata=config(
encoder=str
))
delegation: int = field(metadata=config(
encoder=str
))


@json
Expand Down Expand Up @@ -82,15 +86,17 @@ class Balance:
base_coin: The base coin balance.
required_storage_deposit: The required storage deposit.
native_tokens: The balances of all native tokens.
nfts: All owned NFTs.
accounts: All owned accounts.
foundries: All owned foundries.
nfts: All owned NFTs.
delegations: All owned delegation outputs.
potentially_locked_outputs: A list of potentially locked outputs.
"""
base_coin: BaseCoinBalance
required_storage_deposit: RequiredStorageDeposit
native_tokens: List[NativeTokensBalance]
nfts: List[HexStr]
accounts: List[HexStr]
foundries: List[HexStr]
nfts: List[HexStr]
delegations: List[HexStr]
potentially_locked_outputs: dict[HexStr, bool]
4 changes: 2 additions & 2 deletions sdk/src/wallet/operations/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ where
// Add amount
balance.base_coin.total += delegation.amount();
// Add storage deposit
balance.required_storage_deposit.delegation += rent;
balance.required_storage_deposit.delegation += storage_cost;
if !wallet_data.locked_outputs.contains(output_id) {
total_rent_amount += rent;
total_storage_cost += storage_cost;
}

let delegation_id = delegation.delegation_id_non_null(output_id);
Expand Down

0 comments on commit 1be3a57

Please sign in to comment.