Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix burn in bindings #2155

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions bindings/nodejs/lib/types/client/burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
// SPDX-License-Identifier: Apache-2.0

import { u256 } from '../utils';
import { AccountId, FoundryId, NftId, TokenId } from '../block/id';
import {
AccountId,
DelegationId,
FoundryId,
NftId,
TokenId,
} from '../block/id';

/** A DTO for [`Burn`] */
export interface Burn {
Expand All @@ -12,10 +18,12 @@ export interface Burn {
generatedMana?: boolean;
/** Accounts to burn */
accounts?: AccountId[];
/** NFTs to burn */
nfts?: NftId[];
/** Foundries to burn */
foundries?: FoundryId[];
/** NFTs to burn */
nfts?: NftId[];
/** Delegations to burn */
delegations?: DelegationId[];
/** Amounts of native tokens to burn */
nativeTokens?: Map<TokenId, u256>;
}
24 changes: 17 additions & 7 deletions bindings/python/iota_sdk/types/burn.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ class Burn:
mana: Whether initial excess mana should be burned (only from inputs/outputs that have been specified manually).
generated_mana: Whether generated mana should be burned.
accounts: The accounts to burn.
nfts: The NFTs to burn.
foundries: The foundries to burn.
nfts: The NFTs to burn.
delegations: The delegations to burn.
native_tokens: The native tokens to burn.
"""

mana: Optional[bool] = None
generated_mana: Optional[bool] = None
accounts: Optional[List[HexStr]] = None
nfts: Optional[List[HexStr]] = None
foundries: Optional[List[HexStr]] = None
nfts: Optional[List[HexStr]] = None
delegations: Optional[List[HexStr]] = None
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
native_tokens: Optional[List[NativeToken]] = None

def set_mana(self, burn_mana: bool) -> Burn:
Expand All @@ -49,6 +51,14 @@ def add_account(self, account: HexStr) -> Burn:
self.accounts.append(account)
return self

def add_foundry(self, foundry: HexStr) -> Burn:
"""Add a foundry to the burn.
"""
if self.foundries is None:
self.foundries = []
self.foundries.append(foundry)
return self

def add_nft(self, nft: HexStr) -> Burn:
"""Add an NFT to the burn.
"""
Expand All @@ -57,12 +67,12 @@ def add_nft(self, nft: HexStr) -> Burn:
self.nfts.append(nft)
return self

def add_foundry(self, foundry: HexStr) -> Burn:
"""Add a foundry to the burn.
def add_delegation(self, delegation: HexStr) -> Burn:
"""Add a delegation to the burn.
"""
if self.foundries is None:
self.foundries = []
self.foundries.append(foundry)
if self.delegations is None:
self.delegations = []
self.delegations.append(delegation)
return self

def add_native_token(self, native_token: NativeToken) -> Burn:
Expand Down
Loading