Skip to content

Commit eb23903

Browse files
thibault-martinezThoralf-M
authored andcommitted
chore(ffi): add new_ prefix to some constructors (#110)
* chore(ffi): ass `new_` prefix to some constructors * bindings * remove one new_ * fix python test
1 parent fdd5d46 commit eb23903

File tree

8 files changed

+596
-596
lines changed

8 files changed

+596
-596
lines changed

bindings/go/iota_sdk_ffi/iota_sdk_ffi.go

Lines changed: 123 additions & 123 deletions
Large diffs are not rendered by default.

bindings/go/iota_sdk_ffi/iota_sdk_ffi.h

Lines changed: 151 additions & 151 deletions
Large diffs are not rendered by default.

bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt

Lines changed: 123 additions & 123 deletions
Large diffs are not rendered by default.

bindings/python/lib/iota_sdk_ffi.py

Lines changed: 174 additions & 174 deletions
Large diffs are not rendered by default.

bindings/python/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def main():
6868
)
6969

7070
move_struct = MoveStruct(
71-
struct_type=StructTag.coin(TypeTag.vector(TypeTag.u8())),
71+
struct_type=StructTag.coin(TypeTag.new_vector(TypeTag.new_u8())),
7272
version=1,
7373
contents=bytes(),
7474
)

crates/iota-sdk-ffi/src/faucet.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ impl FaucetClient {
2727

2828
/// Set to local faucet.
2929
#[uniffi::constructor]
30-
pub fn local() -> Self {
30+
pub fn new_local() -> Self {
3131
Self(iota_graphql_client::faucet::FaucetClient::local())
3232
}
3333

3434
/// Set to devnet faucet.
3535
#[uniffi::constructor]
36-
pub fn devnet() -> Self {
36+
pub fn new_devnet() -> Self {
3737
Self(iota_graphql_client::faucet::FaucetClient::devnet())
3838
}
3939

4040
/// Set to testnet faucet.
4141
#[uniffi::constructor]
42-
pub fn testnet() -> Self {
42+
pub fn new_testnet() -> Self {
4343
Self(iota_graphql_client::faucet::FaucetClient::testnet())
4444
}
4545

crates/iota-sdk-ffi/src/types/transaction/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,40 +124,40 @@ pub struct TransactionKind(pub iota_types::TransactionKind);
124124
#[uniffi::export]
125125
impl TransactionKind {
126126
#[uniffi::constructor]
127-
pub fn programmable_transaction(tx: &ProgrammableTransaction) -> Self {
127+
pub fn new_programmable_transaction(tx: &ProgrammableTransaction) -> Self {
128128
Self(iota_types::TransactionKind::ProgrammableTransaction(
129129
tx.0.clone(),
130130
))
131131
}
132132

133133
#[uniffi::constructor]
134-
pub fn genesis(tx: &GenesisTransaction) -> Self {
134+
pub fn new_genesis(tx: &GenesisTransaction) -> Self {
135135
Self(iota_types::TransactionKind::Genesis(tx.0.clone()))
136136
}
137137

138138
#[uniffi::constructor]
139-
pub fn consensus_commit_prologue_v1(tx: &ConsensusCommitPrologueV1) -> Self {
139+
pub fn new_consensus_commit_prologue_v1(tx: &ConsensusCommitPrologueV1) -> Self {
140140
Self(iota_types::TransactionKind::ConsensusCommitPrologueV1(
141141
tx.0.clone(),
142142
))
143143
}
144144

145145
#[uniffi::constructor]
146-
pub fn authenticator_state_update_v1(tx: &AuthenticatorStateUpdateV1) -> Self {
146+
pub fn new_authenticator_state_update_v1(tx: &AuthenticatorStateUpdateV1) -> Self {
147147
Self(iota_types::TransactionKind::AuthenticatorStateUpdateV1(
148148
tx.clone(),
149149
))
150150
}
151151

152152
#[uniffi::constructor]
153-
pub fn end_of_epoch(tx: Vec<Arc<EndOfEpochTransactionKind>>) -> Self {
153+
pub fn new_end_of_epoch(tx: Vec<Arc<EndOfEpochTransactionKind>>) -> Self {
154154
Self(iota_types::TransactionKind::EndOfEpoch(
155155
tx.into_iter().map(|tx| tx.0.clone()).collect(),
156156
))
157157
}
158158

159159
#[uniffi::constructor]
160-
pub fn randomness_state_update(tx: &RandomnessStateUpdate) -> Self {
160+
pub fn new_randomness_state_update(tx: &RandomnessStateUpdate) -> Self {
161161
Self(iota_types::TransactionKind::RandomnessStateUpdate(
162162
tx.clone(),
163163
))
@@ -1368,26 +1368,26 @@ pub struct EndOfEpochTransactionKind(pub iota_types::EndOfEpochTransactionKind);
13681368
#[uniffi::export]
13691369
impl EndOfEpochTransactionKind {
13701370
#[uniffi::constructor]
1371-
pub fn change_epoch(tx: &ChangeEpoch) -> Self {
1371+
pub fn new_change_epoch(tx: &ChangeEpoch) -> Self {
13721372
Self(iota_types::EndOfEpochTransactionKind::ChangeEpoch(
13731373
tx.0.clone(),
13741374
))
13751375
}
13761376

13771377
#[uniffi::constructor]
1378-
pub fn change_epoch_v2(tx: &ChangeEpochV2) -> Self {
1378+
pub fn new_change_epoch_v2(tx: &ChangeEpochV2) -> Self {
13791379
Self(iota_types::EndOfEpochTransactionKind::ChangeEpochV2(
13801380
tx.0.clone(),
13811381
))
13821382
}
13831383

13841384
#[uniffi::constructor]
1385-
pub fn authenticator_state_create() -> Self {
1385+
pub fn new_authenticator_state_create() -> Self {
13861386
Self(iota_types::EndOfEpochTransactionKind::AuthenticatorStateCreate)
13871387
}
13881388

13891389
#[uniffi::constructor]
1390-
pub fn authenticator_state_expire(tx: &AuthenticatorStateExpire) -> Self {
1390+
pub fn new_authenticator_state_expire(tx: &AuthenticatorStateExpire) -> Self {
13911391
Self(iota_types::EndOfEpochTransactionKind::AuthenticatorStateExpire(tx.clone()))
13921392
}
13931393
}

crates/iota-sdk-ffi/src/types/type_tag.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,57 +125,57 @@ impl TypeTag {
125125
}
126126

127127
#[uniffi::constructor]
128-
pub fn u8() -> Self {
128+
pub fn new_u8() -> Self {
129129
Self(iota_types::TypeTag::U8)
130130
}
131131

132132
#[uniffi::constructor]
133-
pub fn u16() -> Self {
133+
pub fn new_u16() -> Self {
134134
Self(iota_types::TypeTag::U16)
135135
}
136136

137137
#[uniffi::constructor]
138-
pub fn u32() -> Self {
138+
pub fn new_u32() -> Self {
139139
Self(iota_types::TypeTag::U32)
140140
}
141141

142142
#[uniffi::constructor]
143-
pub fn u64() -> Self {
143+
pub fn new_u64() -> Self {
144144
Self(iota_types::TypeTag::U64)
145145
}
146146

147147
#[uniffi::constructor]
148-
pub fn u128() -> Self {
148+
pub fn new_u128() -> Self {
149149
Self(iota_types::TypeTag::U128)
150150
}
151151

152152
#[uniffi::constructor]
153-
pub fn u256() -> Self {
153+
pub fn new_u256() -> Self {
154154
Self(iota_types::TypeTag::U256)
155155
}
156156

157157
#[uniffi::constructor]
158-
pub fn bool() -> Self {
158+
pub fn new_bool() -> Self {
159159
Self(iota_types::TypeTag::Bool)
160160
}
161161

162162
#[uniffi::constructor]
163-
pub fn address() -> Self {
163+
pub fn new_address() -> Self {
164164
Self(iota_types::TypeTag::Address)
165165
}
166166

167167
#[uniffi::constructor]
168-
pub fn signer() -> Self {
168+
pub fn new_signer() -> Self {
169169
Self(iota_types::TypeTag::Signer)
170170
}
171171

172172
#[uniffi::constructor]
173-
pub fn vector(type_tag: &TypeTag) -> Self {
173+
pub fn new_vector(type_tag: &TypeTag) -> Self {
174174
Self(iota_types::TypeTag::Vector(Box::new(type_tag.0.clone())))
175175
}
176176

177177
#[uniffi::constructor]
178-
pub fn struct_tag(struct_tag: &StructTag) -> Self {
178+
pub fn new_struct(struct_tag: &StructTag) -> Self {
179179
Self(iota_types::TypeTag::Struct(Box::new(struct_tag.0.clone())))
180180
}
181181
}

0 commit comments

Comments
 (0)