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

Add AnchorOutput and AnchorAddress #1379

Merged
merged 70 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
1b58ea9
Add AnchorOutput and AnchorAddress
thibault-martinez Oct 3, 2023
b6974bb
Start removing account transitions
thibault-martinez Oct 3, 2023
ad91701
More changes
thibault-martinez Oct 3, 2023
a7e6b55
Remove state_metadata
thibault-martinez Oct 3, 2023
ffa9907
More changes
thibault-martinez Oct 3, 2023
72bfa5e
It compiles!!!
thibault-martinez Oct 3, 2023
de48e04
Some more examples fixes
thibault-martinez Oct 3, 2023
f3607b4
More test fixes
thibault-martinez Oct 3, 2023
7265a92
Warnings
thibault-martinez Oct 3, 2023
05fd9c7
Fix some tests
thibault-martinez Oct 3, 2023
503b23f
Some bindings changes
thibault-martinez Oct 4, 2023
9a7af78
More changes :sadcat:
thibault-martinez Oct 4, 2023
693e763
Merge branch '2.0' into account-anchor
thibault-martinez Oct 18, 2023
f772308
Set AnchorAddress type
thibault-martinez Oct 18, 2023
e1d45f3
Add AnchorOutputs address capability
thibault-martinez Oct 18, 2023
cf5c0c6
Add AnchorUnlock
thibault-martinez Oct 18, 2023
77e4ace
Fix ANCHOR_OUTPUTS capability
thibault-martinez Oct 18, 2023
f98c807
Merge branch '2.0' into account-anchor
thibault-martinez Oct 18, 2023
13799e9
Fix test compilation
thibault-martinez Oct 18, 2023
a39870e
Add DESTROY_ANCHOR_OUTPUTS tx capability
thibault-martinez Oct 18, 2023
a9c65a0
Merge branch '2.0' into account-anchor
thibault-martinez Oct 18, 2023
e49f4ab
Add Anchor address cap semantic validation
thibault-martinez Oct 18, 2023
25d24f2
Fix compilation
thibault-martinez Oct 18, 2023
6ae2a3d
Merge branch '2.0' into account-anchor
thibault-martinez Oct 19, 2023
182da92
Temporarily disable test until TIP is updated
thibault-martinez Oct 19, 2023
24f303e
Fix some tests
thibault-martinez Oct 19, 2023
cf58c6e
Last failing tests
thibault-martinez Oct 19, 2023
475be34
Some nits
thibault-martinez Oct 19, 2023
0aa8989
Fix test
thibault-martinez Oct 19, 2023
cda5e14
Merge branch '2.0' into account-anchor
thibault-martinez Oct 19, 2023
f266883
Some Python fixes
thibault-martinez Oct 19, 2023
2dd6618
Nits
thibault-martinez Oct 19, 2023
e70a204
Remove TODO
thibault-martinez Oct 19, 2023
1d01c9e
Doc nit
thibault-martinez Oct 19, 2023
cf1a947
Add Anchor to def_is_as_opt
thibault-martinez Oct 19, 2023
fdabbb9
Display delegations/anchors in CLI addresses cmd
thibault-martinez Oct 19, 2023
d4e11af
Merge branch '2.0' into account-anchor
thibault-martinez Oct 19, 2023
0f7e20e
Merge branch '2.0' into account-anchor
thibault-martinez Oct 20, 2023
55e6b7a
Update sdk/src/client/api/block_builder/input_selection/mod.rs
thibault-martinez Oct 20, 2023
2a772f7
Merge branch '2.0' into account-anchor
thibault-martinez Oct 23, 2023
b39e148
Fix warning
thibault-martinez Oct 23, 2023
5bb1090
Cleanup account transition validation
thibault-martinez Oct 23, 2023
d6ada66
Merge branch '2.0' into account-anchor
thibault-martinez Oct 23, 2023
2590664
Merge branch '2.0' into account-anchor
thibault-martinez Oct 24, 2023
b9d08e1
Merge branch '2.0' into account-anchor
thibault-martinez Oct 25, 2023
7e10894
Merge branch '2.0' into account-anchor
thibault-martinez Oct 26, 2023
72f6fa5
Reviews
thibault-martinez Oct 26, 2023
ea9c91f
Nit
thibault-martinez Oct 26, 2023
33b66e6
Add ISA UnsupportedAddressType error
thibault-martinez Oct 26, 2023
b3a5f9b
impl From<&OutputId> for AnchorAddress
thibault-martinez Oct 26, 2023
fc9c052
Update addresses order and types
thibault-martinez Oct 26, 2023
6d18e5d
Update restricted address tests
thibault-martinez Oct 26, 2023
2fd1cfe
Address semantic TODOs
thibault-martinez Oct 27, 2023
af7748b
required_and_unlocked_address TODO
thibault-martinez Oct 27, 2023
8ee63dd
Address unlock TODO
thibault-martinez Oct 27, 2023
ac111ed
Secret TODO
thibault-martinez Oct 27, 2023
7499d1e
Ledger nano TODO
thibault-martinez Oct 27, 2023
2304003
Reenable test
thibault-martinez Oct 27, 2023
347fa7b
Typo
thibault-martinez Oct 27, 2023
336b652
Merge branch '2.0' into account-anchor
thibault-martinez Oct 27, 2023
f5aff00
Warning
thibault-martinez Oct 27, 2023
d456559
Address Display
thibault-martinez Oct 27, 2023
5eed84a
ISA nits
thibault-martinez Oct 27, 2023
c839f39
Move anchor tx cap
thibault-martinez Oct 27, 2023
72de387
Update rand address modulo
thibault-martinez Oct 27, 2023
0eb1d16
then_some(index)
thibault-martinez Oct 27, 2023
6fbb50b
Fix nodejs example
thibault-martinez Oct 27, 2023
378cb78
Fix python
thibault-martinez Oct 27, 2023
d18127c
wtf
thibault-martinez Oct 27, 2023
0486f15
Merge branch '2.0' into account-anchor
thibault-martinez Oct 27, 2023
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
2 changes: 0 additions & 2 deletions bindings/core/src/method/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ pub enum ClientMethod {
mana: u64,
native_tokens: Option<Vec<NativeToken>>,
account_id: AccountId,
state_index: Option<u32>,
state_metadata: Option<String>,
foundry_counter: Option<u32>,
unlock_conditions: Vec<UnlockConditionDto>,
features: Option<Vec<Feature>>,
Expand Down
4 changes: 0 additions & 4 deletions bindings/core/src/method_handler/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
mana,
native_tokens,
account_id,
state_index,
state_metadata,
foundry_counter,
unlock_conditions,
features,
Expand All @@ -76,8 +74,6 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
mana,
native_tokens,
&account_id,
state_index,
state_metadata.map(prefix_hex::decode).transpose()?,
foundry_counter,
unlock_conditions,
features,
Expand Down
11 changes: 2 additions & 9 deletions bindings/nodejs/examples/client/13-build-account-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import {
Client,
initLogger,
Utils,
StateControllerAddressUnlockCondition,
MetadataFeature,
SenderFeature,
Ed25519Address,
IssuerFeature,
GovernorAddressUnlockCondition,
AddressUnlockCondition,
utf8ToHex,
} from '@iota/sdk';
require('dotenv').config({ path: '.env' });
Expand Down Expand Up @@ -38,14 +37,8 @@ async function run() {
const accountOutput = await client.buildAccountOutput({
accountId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
stateMetadata: utf8ToHex('hello'),
unlockConditions: [
new StateControllerAddressUnlockCondition(
new Ed25519Address(hexAddress),
),
new GovernorAddressUnlockCondition(
new Ed25519Address(hexAddress),
),
new AddressUnlockCondition(new Ed25519Address(hexAddress)),
],
features: [
new SenderFeature(new Ed25519Address(hexAddress)),
Expand Down

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions bindings/nodejs/examples/how_tos/outputs/unlock-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {
ExpirationUnlockCondition,
TimelockUnlockCondition,
SimpleTokenScheme,
StateControllerAddressUnlockCondition,
GovernorAddressUnlockCondition,
ImmutableAccountAddressUnlockCondition,
AccountAddress,
} from '@iota/sdk';
Expand Down Expand Up @@ -81,20 +79,6 @@ async function run() {
],
});

// Output with governor and state controller unlock condition
const accountOutput = await client.buildAccountOutput({
accountId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
unlockConditions: [
new GovernorAddressUnlockCondition(
new Ed25519Address(hexAddress),
),
new StateControllerAddressUnlockCondition(
new Ed25519Address(hexAddress),
),
],
});

// Output with immutable account unlock condition
const foundryOutput = await client.buildFoundryOutput({
serialNumber: 1,
Expand Down
29 changes: 1 addition & 28 deletions bindings/nodejs/lib/types/block/output/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,39 +177,15 @@ abstract class ImmutableFeaturesOutput extends CommonOutput {
}
}

/**
* Base class for state metadata outputs.
*/
abstract class StateMetadataOutput extends ImmutableFeaturesOutput {
readonly stateMetadata?: HexEncodedString;

/**
* @param type The type of output.
* @param amount The amount of the output.
* @param unlockConditions The unlock conditions for the output.
*/
constructor(
type: OutputType,
amount: u64,
unlockConditions: UnlockCondition[],
) {
super(type, amount, unlockConditions);
}
}

/**
* An Account output.
*/
class AccountOutput extends StateMetadataOutput {
class AccountOutput extends ImmutableFeaturesOutput {
/**
* Unique identifier of the account, which is the BLAKE2b-256 hash of the Output ID that created it.
* Unless its a newly created account, then the id is zeroed.
*/
readonly accountId: HexEncodedString;
/**
* A counter that must increase by 1 every time the account output is state transitioned.
*/
readonly stateIndex: number;
/**
* A counter that denotes the number of foundries created by this account output.
*/
Expand All @@ -223,21 +199,18 @@ class AccountOutput extends StateMetadataOutput {
* @param amount The amount of the output.
* @param mana The amount of stored mana.
* @param accountId The account ID as hex-encoded string.
* @param stateIndex A counter that must increase by 1 every time the account output is state transitioned.
* @param foundryCounter A counter that denotes the number of foundries created by this account output.
* @param unlockConditions The unlock conditions of the output.
*/
constructor(
amount: u64,
mana: u64,
accountId: HexEncodedString,
stateIndex: number,
foundryCounter: number,
unlockConditions: UnlockCondition[],
) {
super(OutputType.Account, amount, unlockConditions);
this.accountId = accountId;
this.stateIndex = stateIndex;
this.foundryCounter = foundryCounter;
this.mana = mana;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2021-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { AccountId, Feature, HexEncodedString } from '../..';
import { AccountId, Feature } from '../..';
import type { BasicOutputBuilderParams } from './basic-output-params';

/**
Expand All @@ -12,14 +12,6 @@ export interface AccountOutputBuilderParams extends BasicOutputBuilderParams {
* Unique identifier of an account, which is the BLAKE2b-256 hash of the Output ID that created it.
*/
accountId: AccountId;
/**
* A counter that must increase by 1 every time the account output is state transitioned.
*/
stateIndex?: number;
/**
* Metadata that can only be changed by the state controller.
*/
stateMetadata?: HexEncodedString;
/**
* A counter that denotes the number of foundries created by this account output.
*/
Expand Down
3 changes: 1 addition & 2 deletions bindings/nodejs/lib/types/client/query-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export type QueryParameter =

/** Query parameters for filtering Account Outputs */
export type AccountQueryParameter =
| StateController
| Governor
| Address
| Issuer
| Sender
| UnlockableByAddress
Expand Down
2 changes: 0 additions & 2 deletions bindings/nodejs/lib/types/wallet/transaction-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,4 @@ export interface AccountOutputParams {
immutableMetadata?: HexEncodedString;
/** Hex encoded bytes */
metadata?: HexEncodedString;
/** Hex encoded bytes */
stateMetadata?: HexEncodedString;
}
Loading
Loading