@@ -25,6 +25,7 @@ use std::path::PathBuf;
25
25
use std:: str:: FromStr ;
26
26
27
27
use amplify:: confinement:: { SmallOrdMap , TinyOrdMap , TinyOrdSet , U16 } ;
28
+ use baid58:: ToBaid58 ;
28
29
use bp_util:: { BpCommand , Config , Exec } ;
29
30
use bpstd:: Sats ;
30
31
use psbt:: { Psbt , PsbtVer } ;
@@ -40,6 +41,7 @@ use rgbstd::invoice::{Beneficiary, RgbInvoice, RgbInvoiceBuilder, XChainNet};
40
41
use rgbstd:: persistence:: { Inventory , Stash } ;
41
42
use rgbstd:: schema:: SchemaId ;
42
43
use rgbstd:: validation:: Validity ;
44
+ use rgbstd:: vm:: RgbIsa ;
43
45
use rgbstd:: { AssetTag , AssignmentType , BundleId , OutputSeal , XChain , XOutputSeal } ;
44
46
use seals:: txout:: CloseMethod ;
45
47
use serde_crate:: { Deserialize , Serialize } ;
@@ -804,17 +806,36 @@ impl Exec for RgbArgs {
804
806
} ;
805
807
if let Some ( ( contract, sigs) ) = contract {
806
808
let mut map = map ! [
807
- s!( "genesis" ) => serde_yaml:: to_string( & contract. genesis) ?,
808
- s!( "schema" ) => serde_yaml:: to_string( & contract. schema) ?,
809
- s!( "bundles" ) => serde_yaml:: to_string( & contract. bundles) ?,
810
- s!( "extensions" ) => serde_yaml:: to_string( & contract. extensions) ?,
811
- s!( "sigs" ) => serde_yaml:: to_string( & sigs) ?
809
+ s!( "genesis.yaml" ) => serde_yaml:: to_string( & contract. genesis) ?,
810
+ s!( "schema.yaml" ) => serde_yaml:: to_string( & contract. schema) ?,
811
+ s!( "bundles.yaml" ) => serde_yaml:: to_string( & contract. bundles) ?,
812
+ s!( "extensions.yaml" ) => serde_yaml:: to_string( & contract. extensions) ?,
813
+ s!( "sigs.yaml" ) => serde_yaml:: to_string( & sigs) ?,
814
+ s!( "schema-types.sty" ) => contract. schema. types. to_string( ) ,
812
815
] ;
816
+ for ( id, lib) in & contract. schema . script . as_alu_script ( ) . libs {
817
+ let mut buf = Vec :: new ( ) ;
818
+ lib. print_disassemble :: < RgbIsa > ( & mut buf) ?;
819
+ map. insert ( format ! ( "{}.aluasm" , id. to_baid58( ) . mnemonic( ) ) , unsafe {
820
+ String :: from_utf8_unchecked ( buf)
821
+ } ) ;
822
+ }
813
823
for ( _, pair) in contract. ifaces {
814
824
map. insert (
815
- format ! ( "iface-{}" , pair. iface. name) ,
825
+ format ! ( "iface-{}.yaml " , pair. iface. name) ,
816
826
serde_yaml:: to_string ( & pair) ?,
817
827
) ;
828
+ map. insert (
829
+ format ! ( "iface-{}.sty" , pair. iface. name) ,
830
+ pair. iface . types . to_string ( ) ,
831
+ ) ;
832
+ for ( id, lib) in & pair. iimpl . script . as_alu_script ( ) . libs {
833
+ let mut buf = Vec :: new ( ) ;
834
+ lib. print_disassemble :: < RgbIsa > ( & mut buf) ?;
835
+ map. insert ( format ! ( "{}.aluasm" , id. to_baid58( ) . mnemonic( ) ) , unsafe {
836
+ String :: from_utf8_unchecked ( buf)
837
+ } ) ;
838
+ }
818
839
}
819
840
let contract = ConsignmentInspection {
820
841
version : contract. version ,
@@ -824,11 +845,11 @@ impl Exec for RgbArgs {
824
845
supplements : contract. supplements ,
825
846
signatures : contract. signatures ,
826
847
} ;
827
- map. insert ( s ! ( "consignment-meta" ) , serde_yaml:: to_string ( & contract) ?) ;
848
+ map. insert ( s ! ( "consignment-meta.yaml " ) , serde_yaml:: to_string ( & contract) ?) ;
828
849
let path = path. as_ref ( ) . expect ( "required by clap" ) ;
829
850
fs:: create_dir_all ( path) ?;
830
851
for ( file, value) in map {
831
- fs:: write ( format ! ( "{}/{file}.yaml " , path. display( ) ) , value) ?;
852
+ fs:: write ( format ! ( "{}/{file}" , path. display( ) ) , value) ?;
832
853
}
833
854
}
834
855
None
0 commit comments