Supported Types
The following types can be used in dubhe.config.ts for resource field and key definitions.
Primitive types
dubhe.config.ts | Move type | TypeScript (client) |
|---|---|---|
"bool" | bool | boolean |
"u8" | u8 | number |
"u16" | u16 | number |
"u32" | u32 | number |
"u64" | u64 | bigint |
"u128" | u128 | bigint |
"u256" | u256 | bigint |
"address" | address | string |
"String" | std::ascii::String | string |
Vector types
dubhe.config.ts | Move type | TypeScript (client) |
|---|---|---|
"vector<u8>" | vector<u8> | number[] |
"vector<u16>" | vector<u16> | number[] |
"vector<u32>" | vector<u32> | number[] |
"vector<u64>" | vector<u64> | bigint[] |
"vector<u128>" | vector<u128> | bigint[] |
"vector<u256>" | vector<u256> | bigint[] |
"vector<address>" | vector<address> | string[] |
"vector<bool>" | vector<bool> | boolean[] |
"vector<String>" | vector<String> | string[] |
"vector<vector<u8>>" | vector<vector<u8>> | number[][] |
Enum types
Any enum defined in the enums section of dubhe.config.ts can be used as a field or key type by its name string.
enums: {
Direction: ['North', 'East', 'South', 'West'],
Status: ['Idle', 'Fighting', 'Dead']
},
resources: {
facing: 'Direction', // enum as single value
unit: { fields: { pos: 'address', status: 'Status' } }, // enum as field
combat: { fields: { attacker: 'address', dir: 'Direction' }, keys: ['attacker'] } // enum as key
}Enum variants are encoded as u8 indices via BCS. Each enum gets its own Move module with:
new_<variant>()constructorsis_<variant>()predicatesencode(v)/decode(bcs)for BCS serialization
Type notes
u64,u128,u256are represented asbigintin TypeScript clients to avoid precision loss.Stringrefers tostd::ascii::Stringin Move. Non-ASCII characters are not supported; usevector<u8>for arbitrary bytes.addressis a 32-byte Sui address. When used as aresource_accountparameter, it is passed as a hex-encoded ASCII string (e.g."0x000...00a").vector<u16>is supported in codegen but note that Sui’s BCS does not have a nativepeel_u16; the codegen handles this via manual byte parsing.