Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
wowok committed Dec 11, 2024
1 parent 7babba8 commit d4831fd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ const TESTNET = {
}
*/
const TESTNET = {
wowok: "0xe9eb9e8e3d221e7548af36dee1c302f838f71b6123d3f234db01dd22318544a1",
wowok_origin:'0xe9eb9e8e3d221e7548af36dee1c302f838f71b6123d3f234db01dd22318544a1' ,
base: '0xc262ba18813d193b103f6be17977e6e69d1635685d0f8e30c71ec5de82f782e3',
base_origin: '0xc262ba18813d193b103f6be17977e6e69d1635685d0f8e30c71ec5de82f782e3',

wowok_object: '0xd0ca303d9802a166970203bc8b663f272404f8a9a6aac5604600b05b127c7e1c',
entity_object: '0xd4f2cb8090f64fc769712a9625ef37f35936f6a11b74bcbc5c87fa99527133d8',
treasury_cap:'0xa8e47d96fbdf360d22cd25cd55c32a5d5019c35e2e1a311e0668c77b80f7aeda',
wowok: "0x03ff6124da870ac002831580572339292d12eed6d41bc1e15c20a63b725e4d13",
wowok_origin:'0x03ff6124da870ac002831580572339292d12eed6d41bc1e15c20a63b725e4d13' ,
base: '0x697414cbf771c0cb0ab4e2ec335fc310a19936b628cfdb0d8d4190042ee998f9',
base_origin: '0x697414cbf771c0cb0ab4e2ec335fc310a19936b628cfdb0d8d4190042ee998f9',

wowok_object: '0x05929fea08ee82f0711ae25590dcd58182af81ff34cc275eb1caca4f7c7041f5',
entity_object: '0x42e6da560324e891e8d695464da3ccc9f1fc0d33bc3b962cb7338d8f9198a595',
treasury_cap:'0x66a76f713edd26d4db2aa64343edc10e3df6cacbd66f2e5c5e5b6fbddac6e575',
}
const MAINNET = {
wowok: "",
Expand Down
18 changes: 15 additions & 3 deletions src/service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, parseObjectType, array_unique, IsValidTokenType, IsValidDesription,
IsValidAddress, IsValidEndpoint, IsValidU64, } from './utils'
IsValidAddress, IsValidEndpoint, IsValidU64,
IsValidName, } from './utils'
import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryObject, MachineObject, ServiceAddress,
ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol, ValueType,
TxbObject,
Expand Down Expand Up @@ -841,9 +842,18 @@ export class Service {
}
}

set_customer_required(pubkey:string, customer_required: BuyRequiredEnum[], passport?:PassportObject) {
set_customer_required(pubkey:string, customer_required: (BuyRequiredEnum | string)[], passport?:PassportObject) {
if(customer_required.length > 0 && !pubkey) {
ERROR(Errors.InvalidParam, 'pubkey')
ERROR(Errors.InvalidParam, 'set_customer_required')
}
if(pubkey.length > Service.MAX_PUBKEY_SIZE) {
ERROR(Errors.InvalidParam, 'set_customer_required.pubkey')
}
if(customer_required.length > Service.MAX_REQUIRES_COUNT) {
ERROR(Errors.InvalidParam, 'set_customer_required.customer_required')
}
if(!IsValidArray(customer_required, IsValidName)) {
ERROR(Errors.IsValidArray, 'set_customer_required.customer_required')
}

let req = array_unique(customer_required) as string[];
Expand Down Expand Up @@ -1180,6 +1190,8 @@ export class Service {
static MAX_ORDER_AGENT_COUNT = 8;
static MAX_ORDER_ARBS_COUNT = 8;
static MAX_ARBITRATION_COUNT = 8;
static MAX_REQUIRES_COUNT = 16;
static MAX_PUBKEY_SIZE = 3000;

static IsValidItemName(name:string) : boolean {
if (!name) return false;
Expand Down

0 comments on commit d4831fd

Please sign in to comment.