Skip to content

Commit

Permalink
Fix sdk builder (#4217)
Browse files Browse the repository at this point in the history
* fix move source compiling errors

* disable some test code in Move source
* build a new release of framework

* update some names

* update some names in starcoin-sdk-builder

* use starcoin-vm-types instead of starcoin-types

* generate framework to cached-packages
  • Loading branch information
simonjiao authored Sep 29, 2024
1 parent 0f53add commit 3042818
Show file tree
Hide file tree
Showing 101 changed files with 7,108 additions and 7,043 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ build/
*.bak

# CI experimental mold binary
mold
mold

# ignore framework release bundle file
**/*.mrb
3,966 changes: 2,018 additions & 1,948 deletions vm/framework/cached-packages/src/starcoin_framework_sdk_builder.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
#![allow(clippy::too_many_arguments)]
#![allow(clippy::arc_with_non_send_sync)]
#![allow(clippy::get_first)]
#![allow(unused_imports)]
use move_core_types::{
ident_str,
language_storage::{ModuleId, TypeTag},
};
use starcoin_vm_types::{
account_address::AccountAddress,
transaction::{ScriptFunction, TransactionPayload},
transaction::{EntryFunction, TransactionPayload},
};
use std::collections::BTreeMap as Map;

type Bytes = Vec<u8>;

Expand Down Expand Up @@ -159,7 +161,7 @@ impl EntryFunctionCall {

/// Try to recognize an Starcoin `TransactionPayload` and convert it into a structured object `EntryFunctionCall`.
pub fn decode(payload: &TransactionPayload) -> Option<EntryFunctionCall> {
if let TransactionPayload::ScriptFunction(script) = payload {
if let TransactionPayload::EntryFunction(script) = payload {
match SCRIPT_FUNCTION_DECODER_MAP.get(&format!(
"{}_{}",
script.module().name(),
Expand Down Expand Up @@ -192,13 +194,9 @@ pub fn starcoin_token_create_collection(
royalty_numerator: u64,
royalty_denominator: u64,
) -> TransactionPayload {
TransactionPayload::ScriptFunction(ScriptFunction::new(
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
]),
AccountAddress::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4]),
ident_str!("starcoin_token").to_owned(),
),
ident_str!("create_collection").to_owned(),
Expand Down Expand Up @@ -233,13 +231,9 @@ pub fn starcoin_token_mint(
property_types: Vec<Vec<u8>>,
property_values: Vec<Vec<u8>>,
) -> TransactionPayload {
TransactionPayload::ScriptFunction(ScriptFunction::new(
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
]),
AccountAddress::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4]),
ident_str!("starcoin_token").to_owned(),
),
ident_str!("mint").to_owned(),
Expand Down Expand Up @@ -267,13 +261,9 @@ pub fn starcoin_token_mint_soul_bound(
property_values: Vec<Vec<u8>>,
soul_bound_to: AccountAddress,
) -> TransactionPayload {
TransactionPayload::ScriptFunction(ScriptFunction::new(
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
]),
AccountAddress::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4]),
ident_str!("starcoin_token").to_owned(),
),
ident_str!("mint_soul_bound").to_owned(),
Expand All @@ -295,7 +285,7 @@ mod decoder {
pub fn starcoin_token_create_collection(
payload: &TransactionPayload,
) -> Option<EntryFunctionCall> {
if let TransactionPayload::ScriptFunction(script) = payload {
if let TransactionPayload::EntryFunction(script) = payload {
Some(EntryFunctionCall::StarcoinTokenCreateCollection {
description: bcs::from_bytes(script.args().get(0)?).ok()?,
max_supply: bcs::from_bytes(script.args().get(1)?).ok()?,
Expand All @@ -319,7 +309,7 @@ mod decoder {
}

pub fn starcoin_token_mint(payload: &TransactionPayload) -> Option<EntryFunctionCall> {
if let TransactionPayload::ScriptFunction(script) = payload {
if let TransactionPayload::EntryFunction(script) = payload {
Some(EntryFunctionCall::StarcoinTokenMint {
collection: bcs::from_bytes(script.args().get(0)?).ok()?,
description: bcs::from_bytes(script.args().get(1)?).ok()?,
Expand All @@ -334,8 +324,10 @@ mod decoder {
}
}

pub fn starcoin_token_mint_soul_bound(payload: &TransactionPayload) -> Option<EntryFunctionCall> {
if let TransactionPayload::ScriptFunction(script) = payload {
pub fn starcoin_token_mint_soul_bound(
payload: &TransactionPayload,
) -> Option<EntryFunctionCall> {
if let TransactionPayload::EntryFunction(script) = payload {
Some(EntryFunctionCall::StarcoinTokenMintSoulBound {
collection: bcs::from_bytes(script.args().get(0)?).ok()?,
description: bcs::from_bytes(script.args().get(1)?).ok()?,
Expand Down
Loading

0 comments on commit 3042818

Please sign in to comment.