Skip to content

Commit 8ab08f3

Browse files
committed
remove interfaces
1 parent 91a913f commit 8ab08f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1128
-4216
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asset/armored_contract.default

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-----BEGIN RGB CONSIGNMENT-----
2-
Id: rgb:csg:NMRVC2V8-NS3mHk0-a2pWAhM-OSv789X-gshAO4R-3DTR9gY#visual-scorpio-kansas
2+
Id: rgb:csg:E2gglPSZ-ol15s0v-7Bsn7g0-palSQ8e-BEHjsAS-dDLeiNA#cheese-virtual-andy
33
Version: 2
44
Type: contract
55
Contract: rgb:C9vGwULI-zVhMBCR-jRacB$r-Bf7qloC-ixe$Lcq-xu9AnJ4
66
Schema: rgb:sch:DZTJx1!$gw9X2Y3uC2aeeV!fR8qNUwUqsCbICKwwRqY#yellow-doctor-number
7-
Check-SHA256: d31e237c99dd9906a316b904af7df3cf0bbed220bd9d1b672377d2e2683be433
7+
Check-SHA256: f196c6351598246c77e4c830d8f42844af209a0da57783d0f65232fb6498a78d
88

99
0ssI2000000000000000000000000000000000000000000000000000000D0CRI`I$>^aZh38Qb#np$
10-
0000000000000C|VQpmq000000000D0CRI`I$>^aZh38Qb#nj!00000000000000000000000000000
10+
0000000000000C|VQpmq000000000D0CRI`I$>^aZh38Qb#nj!0000000000000000000000000000
1111

1212
-----END RGB CONSIGNMENT-----

asset/armored_kit.default

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
-----BEGIN RGB KIT-----
2-
Id: rgb:kit:5PcH5BM9-JI91Fhx-R0TUG4o-ZqLwv6r-UHlivQn-x1q6XqA
2+
Id: rgb:kit:ij7UAXOl-MCrXzKt-L8fC6Vu-e$xPh5k-GEurStO-4RNfzsI
33
Version: 2
44
Type-System: sts:8Vb$sM1F-5MsQc20-HEixf55-gJR37FM-0zRKfpY-SwIp35w#design-farmer-camel
5-
Check-SHA256: 337a32712f14c5df0b57a64bd6c321a043081688ecd4f33fd8319470da2256b1
5+
Check-SHA256: d86e8112f3c4c4442126f8e9f44f16867da487f29052bf91b810457db34209a4
66

7-
0ssI200000000
7+
0ssI200000
88

99
-----END RGB KIT-----

asset/armored_transfer.default

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-----BEGIN RGB CONSIGNMENT-----
2-
Id: rgb:csg:nYQ0UGV2-dWzSP1M-PV$XFFx-T2wgOuw-IYecFIO-2XATOAI#monkey-zebra-minute
2+
Id: rgb:csg:g4ZDNtpl-RgfaP7f-bxGts!Y-vjw!IS5-5oGn70b-uS9Pmjg#twin-pardon-member
33
Version: 2
44
Type: transfer
55
Contract: rgb:C9vGwULI-zVhMBCR-jRacB$r-Bf7qloC-ixe$Lcq-xu9AnJ4
66
Schema: rgb:sch:DZTJx1!$gw9X2Y3uC2aeeV!fR8qNUwUqsCbICKwwRqY#yellow-doctor-number
7-
Check-SHA256: 42db055d91cb9eec55930f7912b92fe029ab186cad2ab94fc81ee86872a8ada3
7+
Check-SHA256: c31f56b8ef659a7b7294baeca1812604756e0c12443fce0dc81ae0bf19640e81
88

99
0s#O3000000000000000000000000000000000000000000000000000000D0CRI`I$>^aZh38Qb#np$
10-
0000000000000C|VQpmq000000000D0CRI`I$>^aZh38Qb#nj!00000000000000000000000000000
10+
0000000000000C|VQpmq000000000D0CRI`I$>^aZh38Qb#nj!0000000000000000000000000000
1111

1212
-----END RGB CONSIGNMENT-----

asset/transfer.default

-1 Bytes
Binary file not shown.

invoice/src/builder.rs

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
use std::str::FromStr;
2323

24-
use rgb::ContractId;
25-
use strict_encoding::{FieldName, TypeName};
24+
use rgb::{ContractId, SchemaId};
25+
use strict_types::FieldName;
2626

2727
use crate::invoice::{Beneficiary, InvoiceState, RgbInvoice, RgbTransport, XChainNet};
2828
use crate::{Allocation, Amount, CoinAmount, NonFungible, Precision, TransportParseError};
@@ -36,11 +36,10 @@ impl RgbInvoiceBuilder {
3636
Self(RgbInvoice {
3737
transports: vec![RgbTransport::UnspecifiedMeans],
3838
contract: None,
39-
iface: None,
40-
operation: None,
41-
assignment: None,
39+
schema: None,
40+
assignment_name: None,
41+
assignment_state: InvoiceState::Void,
4242
beneficiary: beneficiary.into(),
43-
owned_state: InvoiceState::Void,
4443
expiry: None,
4544
unknown_query: none!(),
4645
})
@@ -50,36 +49,23 @@ impl RgbInvoiceBuilder {
5049
Self::new(beneficiary).set_contract(contract_id)
5150
}
5251

53-
pub fn rgb20(contract_id: ContractId, beneficiary: impl Into<XChainNet<Beneficiary>>) -> Self {
54-
Self::with(contract_id, beneficiary).set_interface("RGB20")
55-
}
56-
57-
pub fn rgb20_anything(beneficiary: impl Into<XChainNet<Beneficiary>>) -> Self {
58-
Self::new(beneficiary).set_interface("RGB20")
59-
}
60-
6152
pub fn set_contract(mut self, contract_id: ContractId) -> Self {
6253
self.0.contract = Some(contract_id);
6354
self
6455
}
6556

66-
pub fn set_interface(mut self, name: impl Into<TypeName>) -> Self {
67-
self.0.iface = Some(name.into());
68-
self
69-
}
70-
71-
pub fn set_operation(mut self, name: impl Into<FieldName>) -> Self {
72-
self.0.operation = Some(name.into());
57+
pub fn set_schema(mut self, schema_id: SchemaId) -> Self {
58+
self.0.schema = Some(schema_id);
7359
self
7460
}
7561

76-
pub fn set_assignment(mut self, name: impl Into<FieldName>) -> Self {
77-
self.0.assignment = Some(name.into());
62+
pub fn set_assignment_name(mut self, assignment_name: FieldName) -> Self {
63+
self.0.assignment_name = Some(assignment_name);
7864
self
7965
}
8066

8167
pub fn set_amount_raw(mut self, amount: impl Into<Amount>) -> Self {
82-
self.0.owned_state = InvoiceState::Amount(amount.into());
68+
self.0.assignment_state = InvoiceState::Amount(amount.into());
8369
self
8470
}
8571

@@ -94,12 +80,13 @@ impl RgbInvoiceBuilder {
9480
Err(_) => return Err(self),
9581
}
9682
.to_amount_unchecked();
97-
self.0.owned_state = InvoiceState::Amount(amount);
83+
self.0.assignment_state = InvoiceState::Amount(amount);
9884
Ok(self)
9985
}
10086

10187
pub fn set_allocation_raw(mut self, allocation: impl Into<Allocation>) -> Self {
102-
self.0.owned_state = InvoiceState::Data(NonFungible::RGB21(allocation.into()));
88+
self.0.assignment_state =
89+
InvoiceState::Data(NonFungible::FractionedToken(allocation.into()));
10390
self
10491
}
10592

invoice/src/data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ use crate::LIB_NAME_RGB_CONTRACT;
3737
)]
3838
pub enum NonFungible {
3939
#[display(inner)]
40-
RGB21(Allocation),
40+
FractionedToken(Allocation),
4141
}
4242

4343
impl FromStr for NonFungible {
4444
type Err = AllocationParseError;
4545
fn from_str(s: &str) -> Result<Self, Self::Err> {
4646
let allocation = Allocation::from_str(s)?;
47-
Ok(NonFungible::RGB21(allocation))
47+
Ok(NonFungible::FractionedToken(allocation))
4848
}
4949
}
5050

invoice/src/invoice.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use amplify::{ByteArray, Bytes32};
2626
use bp::{InvalidPubkey, OutputPk, PubkeyHash, ScriptHash, WPubkeyHash, WScriptHash};
2727
use indexmap::IndexMap;
2828
use invoice::{AddressNetwork, AddressPayload, Network};
29-
use rgb::{AttachId, ChainNet, ContractId, Layer1, SecretSeal};
30-
use strict_encoding::{FieldName, TypeName};
29+
use rgb::{AttachId, ChainNet, ContractId, Layer1, SchemaId, SecretSeal, StateType};
30+
use strict_types::FieldName;
3131

3232
use crate::{Amount, NonFungible};
3333

@@ -78,6 +78,17 @@ impl FromStr for InvoiceState {
7878
}
7979
}
8080

81+
impl From<InvoiceState> for StateType {
82+
fn from(val: InvoiceState) -> Self {
83+
match val {
84+
InvoiceState::Void => StateType::Void,
85+
InvoiceState::Amount(_) => StateType::Fungible,
86+
InvoiceState::Data(_) => StateType::Structured,
87+
InvoiceState::Attach(_) => StateType::Attachment,
88+
}
89+
}
90+
}
91+
8192
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
8293
#[non_exhaustive]
8394
pub enum XChainNet<T> {
@@ -214,11 +225,10 @@ pub enum Beneficiary {
214225
pub struct RgbInvoice {
215226
pub transports: Vec<RgbTransport>,
216227
pub contract: Option<ContractId>,
217-
pub iface: Option<TypeName>,
218-
pub operation: Option<FieldName>,
219-
pub assignment: Option<FieldName>,
228+
pub schema: Option<SchemaId>,
229+
pub assignment_name: Option<FieldName>,
230+
pub assignment_state: InvoiceState,
220231
pub beneficiary: XChainNet<Beneficiary>,
221-
pub owned_state: InvoiceState,
222232
/// UTC unix timestamp
223233
pub expiry: Option<i64>,
224234
pub unknown_query: IndexMap<String, String>,

0 commit comments

Comments
 (0)