@0xobelisk/client 0.4.7 → 1.2.0-pre.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +550 -2
  2. package/dist/browser/obelisk-client.js +102 -0
  3. package/dist/browser/obelisk-client.js.LICENSE.txt +16 -0
  4. package/dist/browser/obelisk-client.js.map +1 -0
  5. package/dist/browser/obelisk-client.min.js +101 -0
  6. package/dist/browser/obelisk-client.min.js.map +1 -0
  7. package/dist/index.d.ts +27 -9
  8. package/dist/sui/client.d.ts +59 -0
  9. package/dist/sui/index.d.mts +156 -0
  10. package/dist/sui/index.d.ts +19 -0
  11. package/dist/sui/index.js +93 -0
  12. package/dist/sui/index.js.map +1 -0
  13. package/dist/sui/index.mjs +88 -0
  14. package/dist/sui/index.mjs.map +1 -0
  15. package/dist/sui/types.d.ts +90 -0
  16. package/package.json +60 -121
  17. package/src/index.ts +31 -9
  18. package/src/sui/client.test.ts +277 -0
  19. package/src/sui/client.ts +157 -0
  20. package/src/sui/index.ts +30 -0
  21. package/src/sui/types.ts +94 -0
  22. package/LICENSE +0 -92
  23. package/dist/index.js +0 -1287
  24. package/dist/index.js.map +0 -1
  25. package/dist/index.mjs +0 -1268
  26. package/dist/index.mjs.map +0 -1
  27. package/dist/libs/suiAccountManager/crypto.d.ts +0 -1
  28. package/dist/libs/suiAccountManager/index.d.ts +0 -35
  29. package/dist/libs/suiAccountManager/keypair.d.ts +0 -21
  30. package/dist/libs/suiAccountManager/util.d.ts +0 -29
  31. package/dist/libs/suiContractFactory/index.d.ts +0 -20
  32. package/dist/libs/suiContractFactory/types.d.ts +0 -49
  33. package/dist/libs/suiInteractor/defaultConfig.d.ts +0 -10
  34. package/dist/libs/suiInteractor/index.d.ts +0 -2
  35. package/dist/libs/suiInteractor/suiInteractor.d.ts +0 -205
  36. package/dist/libs/suiInteractor/util.d.ts +0 -1
  37. package/dist/libs/suiModel/index.d.ts +0 -2
  38. package/dist/libs/suiModel/suiOwnedObject.d.ts +0 -24
  39. package/dist/libs/suiModel/suiSharedObject.d.ts +0 -12
  40. package/dist/libs/suiTxBuilder/index.d.ts +0 -544
  41. package/dist/libs/suiTxBuilder/util.d.ts +0 -76
  42. package/dist/metadata/index.d.ts +0 -34
  43. package/dist/obelisk.d.ts +0 -2566
  44. package/dist/types/index.d.ts +0 -141
  45. package/dist/utils/index.d.ts +0 -3
  46. package/src/libs/suiAccountManager/crypto.ts +0 -7
  47. package/src/libs/suiAccountManager/index.ts +0 -72
  48. package/src/libs/suiAccountManager/keypair.ts +0 -38
  49. package/src/libs/suiAccountManager/util.ts +0 -70
  50. package/src/libs/suiContractFactory/index.ts +0 -120
  51. package/src/libs/suiContractFactory/types.ts +0 -54
  52. package/src/libs/suiInteractor/defaultConfig.ts +0 -32
  53. package/src/libs/suiInteractor/index.ts +0 -2
  54. package/src/libs/suiInteractor/suiInteractor.ts +0 -319
  55. package/src/libs/suiInteractor/util.ts +0 -2
  56. package/src/libs/suiModel/index.ts +0 -2
  57. package/src/libs/suiModel/suiOwnedObject.ts +0 -62
  58. package/src/libs/suiModel/suiSharedObject.ts +0 -33
  59. package/src/libs/suiTxBuilder/index.ts +0 -245
  60. package/src/libs/suiTxBuilder/util.ts +0 -84
  61. package/src/metadata/index.ts +0 -22
  62. package/src/obelisk.ts +0 -600
  63. package/src/types/index.ts +0 -205
  64. package/src/utils/index.ts +0 -23
@@ -1,141 +0,0 @@
1
- import { Infer } from 'superstruct';
2
- import { DisplayFieldsResponse, ObjectCallArg, ObjectContentFields, SharedObjectRef, SuiObjectRef, TransactionArgument, TransactionBlock, SuiTransactionBlockResponse, DevInspectResults, SuiMoveNormalizedModules } from '@mysten/sui.js';
3
- import { SuiMoveMoudleFuncType } from '../libs/suiContractFactory/types';
4
- export type ObeliskObjectData = {
5
- objectId: string;
6
- objectType: string;
7
- objectVersion: number;
8
- objectDisplay: DisplayFieldsResponse;
9
- objectFields: ObjectContentFields;
10
- };
11
- export type ObeliskParams = {
12
- mnemonics?: string;
13
- secretKey?: string;
14
- fullnodeUrls?: string[];
15
- faucetUrl?: string;
16
- networkType?: NetworkType;
17
- packageId?: string;
18
- metadata?: SuiMoveNormalizedModules;
19
- };
20
- export type SchemaFieldType = {
21
- schemas: {
22
- type: string;
23
- fields: {
24
- id: {
25
- id: string;
26
- };
27
- size: string;
28
- };
29
- };
30
- };
31
- export type SchemaValueType = {
32
- id: {
33
- id: string;
34
- };
35
- name: string;
36
- value: {
37
- type: string;
38
- fields: SchemaFieldType;
39
- };
40
- };
41
- export type SuiTxArgument = {
42
- kind: 'Input';
43
- index: number;
44
- type?: 'object' | 'pure' | undefined;
45
- value?: any;
46
- } | {
47
- kind: 'GasCoin';
48
- } | {
49
- kind: 'Result';
50
- index: number;
51
- } | {
52
- kind: 'NestedResult';
53
- index: number;
54
- resultIndex: number;
55
- };
56
- export type SchemaContentType = {
57
- type: string;
58
- fields: SchemaValueType;
59
- hasPublicTransfer: boolean;
60
- dataType: 'moveObject';
61
- };
62
- export interface MessageMeta {
63
- readonly meta: SuiMoveMoudleFuncType;
64
- }
65
- export interface ContractQuery extends MessageMeta {
66
- (tx: TransactionBlock, params: SuiTxArgument[], isRaw?: boolean): Promise<DevInspectResults | TransactionBlock>;
67
- }
68
- export interface ContractTx extends MessageMeta {
69
- (tx: TransactionBlock, params: SuiTxArgument[], isRaw?: boolean): SuiTransactionBlockResponse | TransactionBlock;
70
- }
71
- export type MapMessageTx = Record<string, ContractTx>;
72
- export type MapMessageQuery = Record<string, ContractQuery>;
73
- export type MapMoudleFuncTx = Record<string, MapMessageTx>;
74
- export type MapMoudleFuncQuery = Record<string, MapMessageQuery>;
75
- export type MapMoudleFuncTest = Record<string, Record<string, string>>;
76
- export type MapMoudleFuncQueryTest = Record<string, Record<string, string>>;
77
- export type AccountMangerParams = {
78
- mnemonics?: string;
79
- secretKey?: string;
80
- };
81
- export type DerivePathParams = {
82
- accountIndex?: number;
83
- isExternal?: boolean;
84
- addressIndex?: number;
85
- };
86
- export type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
87
- export type FaucetNetworkType = 'testnet' | 'devnet' | 'localnet';
88
- export type SuiKitParams = {
89
- mnemonics?: string;
90
- secretKey?: string;
91
- fullnodeUrls?: string[];
92
- faucetUrl?: string;
93
- networkType?: NetworkType;
94
- };
95
- export type ObjectData = {
96
- objectId: string;
97
- objectType: string;
98
- objectVersion: number;
99
- objectDigest: string;
100
- initialSharedVersion?: number;
101
- objectDisplay: DisplayFieldsResponse;
102
- objectFields: ObjectContentFields;
103
- };
104
- export type ObjectFieldType = {
105
- id: {
106
- id: string;
107
- };
108
- name: string;
109
- value: string;
110
- };
111
- export type EntityData = {
112
- objectId: string;
113
- index: string;
114
- key: string;
115
- };
116
- export type SuiTxArg = Infer<typeof TransactionArgument> | Infer<typeof ObjectCallArg> | string | number | bigint | boolean;
117
- export type SuiObjectArg = SharedObjectRef | Infer<typeof SuiObjectRef> | string | Infer<typeof ObjectCallArg> | Infer<typeof TransactionArgument>;
118
- export type SuiVecTxArg = {
119
- value: SuiTxArg[];
120
- vecType: SuiInputTypes;
121
- } | SuiTxArg[];
122
- /**
123
- * These are the basics types that can be used in the SUI
124
- */
125
- export type SuiBasicTypes = 'address' | 'bool' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256';
126
- export type SuiInputTypes = 'object' | SuiBasicTypes;
127
- export type SuiReturnValues = {
128
- returnValues: [number[], string][];
129
- }[];
130
- export type DynamicFieldContentType = {
131
- type: string;
132
- fields: Record<string, any>;
133
- hasPublicTransfer: boolean;
134
- dataType: string;
135
- };
136
- export type ObjectContent = {
137
- type: string;
138
- fields: Record<string, any>;
139
- hasPublicTransfer: boolean;
140
- dataType: string;
141
- };
@@ -1,3 +0,0 @@
1
- export declare function capitalizeFirstLetter(input: string): string;
2
- export declare function normalizeHexAddress(input: string): string | null;
3
- export declare function numberToAddressHex(num: number): string;
@@ -1,7 +0,0 @@
1
- import { generateMnemonic as genMnemonic } from '@scure/bip39';
2
- import { wordlist } from '@scure/bip39/wordlists/english';
3
-
4
- export const generateMnemonic = (numberOfWords: 12 | 24 = 24) => {
5
- const strength = numberOfWords === 12 ? 128 : 256;
6
- return genMnemonic(wordlist, strength);
7
- };
@@ -1,72 +0,0 @@
1
- import { Ed25519Keypair } from '@mysten/sui.js';
2
- import { getKeyPair } from './keypair';
3
- import { hexOrBase64ToUint8Array, normalizePrivateKey } from './util';
4
- import { generateMnemonic } from './crypto';
5
- import type { AccountMangerParams, DerivePathParams } from '../../types';
6
-
7
- export class SuiAccountManager {
8
- private mnemonics: string;
9
- private secretKey: string;
10
- public currentKeyPair: Ed25519Keypair;
11
- public currentAddress: string;
12
-
13
- /**
14
- * Support the following ways to init the SuiToolkit:
15
- * 1. mnemonics
16
- * 2. secretKey (base64 or hex)
17
- * If none of them is provided, will generate a random mnemonics with 24 words.
18
- *
19
- * @param mnemonics, 12 or 24 mnemonics words, separated by space
20
- * @param secretKey, base64 or hex string, when mnemonics is provided, secretKey will be ignored
21
- */
22
- constructor({ mnemonics, secretKey }: AccountMangerParams = {}) {
23
- // If the mnemonics or secretKey is provided, use it
24
- // Otherwise, generate a random mnemonics with 24 words
25
- this.mnemonics = mnemonics || '';
26
- this.secretKey = secretKey || '';
27
- if (!this.mnemonics && !this.secretKey) {
28
- this.mnemonics = generateMnemonic(24);
29
- }
30
-
31
- // Init the current account
32
- this.currentKeyPair = this.secretKey
33
- ? Ed25519Keypair.fromSecretKey(
34
- normalizePrivateKey(hexOrBase64ToUint8Array(this.secretKey))
35
- )
36
- : getKeyPair(this.mnemonics);
37
- this.currentAddress = this.currentKeyPair.getPublicKey().toSuiAddress();
38
- }
39
-
40
- /**
41
- * if derivePathParams is not provided or mnemonics is empty, it will return the currentKeyPair.
42
- * else:
43
- * it will generate keyPair from the mnemonic with the given derivePathParams.
44
- */
45
- getKeyPair(derivePathParams?: DerivePathParams) {
46
- if (!derivePathParams || !this.mnemonics) return this.currentKeyPair;
47
- return getKeyPair(this.mnemonics, derivePathParams);
48
- }
49
-
50
- /**
51
- * if derivePathParams is not provided or mnemonics is empty, it will return the currentAddress.
52
- * else:
53
- * it will generate address from the mnemonic with the given derivePathParams.
54
- */
55
- getAddress(derivePathParams?: DerivePathParams) {
56
- if (!derivePathParams || !this.mnemonics) return this.currentAddress;
57
- return getKeyPair(this.mnemonics, derivePathParams)
58
- .getPublicKey()
59
- .toSuiAddress();
60
- }
61
-
62
- /**
63
- * Switch the current account with the given derivePathParams.
64
- * This is only useful when the mnemonics is provided. For secretKey mode, it will always use the same account.
65
- */
66
- switchAccount(derivePathParams: DerivePathParams) {
67
- if (this.mnemonics) {
68
- this.currentKeyPair = getKeyPair(this.mnemonics, derivePathParams);
69
- this.currentAddress = this.currentKeyPair.getPublicKey().toSuiAddress();
70
- }
71
- }
72
- }
@@ -1,38 +0,0 @@
1
- import { Ed25519Keypair, fromB64 } from '@mysten/sui.js';
2
- import type { DerivePathParams } from 'src/types';
3
-
4
- /**
5
- * @description Get ed25519 derive path for SUI
6
- * @param derivePathParams
7
- */
8
- export const getDerivePathForSUI = (
9
- derivePathParams: DerivePathParams = {}
10
- ) => {
11
- const {
12
- accountIndex = 0,
13
- isExternal = false,
14
- addressIndex = 0,
15
- } = derivePathParams;
16
- return `m/44'/784'/${accountIndex}'/${isExternal ? 1 : 0}'/${addressIndex}'`;
17
- };
18
-
19
- /**
20
- * the format is m/44'/784'/accountIndex'/${isExternal ? 1 : 0}'/addressIndex'
21
- *
22
- * accountIndex is the index of the account, default is 0.
23
- *
24
- * isExternal is the type of the address, default is false. Usually, the external address is used to receive coins. The internal address is used to change coins.
25
- *
26
- * addressIndex is the index of the address, default is 0. It's used to generate multiple addresses for one account.
27
- *
28
- * @description Get keypair from mnemonics and derive path
29
- * @param mnemonics
30
- * @param derivePathParams
31
- */
32
- export const getKeyPair = (
33
- mnemonics: string,
34
- derivePathParams: DerivePathParams = {}
35
- ) => {
36
- const derivePath = getDerivePathForSUI(derivePathParams);
37
- return Ed25519Keypair.deriveKeypair(mnemonics, derivePath);
38
- };
@@ -1,70 +0,0 @@
1
- import { fromB64 } from '@mysten/sui.js';
2
-
3
- /**
4
- * @description This regular expression matches any string that contains only hexadecimal digits (0-9, A-F, a-f).
5
- * @param str
6
- */
7
- export const isHex = (str: string) =>
8
- /^0x[0-9a-fA-F]+$|^[0-9a-fA-F]+$/.test(str);
9
-
10
- /**
11
- * @description This regular expression matches any string that contains only base64 digits (0-9, A-Z, a-z, +, /, =).
12
- * Note that the "=" signs at the end are optional padding characters that may be present in some base64 encoded strings.
13
- * @param str
14
- */
15
- export const isBase64 = (str: string) => /^[a-zA-Z0-9+/]+={0,2}$/g.test(str);
16
-
17
- /**
18
- * Convert a hex string to Uint8Array
19
- * @param hexStr
20
- */
21
- export const fromHEX = (hexStr: string): Uint8Array => {
22
- if (!hexStr) {
23
- throw new Error('cannot parse empty string to Uint8Array');
24
- }
25
- const intArr = hexStr
26
- .replace('0x', '')
27
- .match(/.{1,2}/g)
28
- ?.map((byte) => parseInt(byte, 16));
29
-
30
- if (!intArr || intArr.length === 0) {
31
- throw new Error(`Unable to parse HEX: ${hexStr}`);
32
- }
33
- return Uint8Array.from(intArr);
34
- };
35
-
36
- /**
37
- * @description Convert a hex or base64 string to Uint8Array
38
- */
39
- export const hexOrBase64ToUint8Array = (str: string): Uint8Array => {
40
- if (isHex(str)) {
41
- return fromHEX(str);
42
- } else if (isBase64(str)) {
43
- return fromB64(str);
44
- } else {
45
- throw new Error('The string is not a valid hex or base64 string.');
46
- }
47
- };
48
-
49
- const PRIVATE_KEY_SIZE = 32;
50
- const LEGACY_PRIVATE_KEY_SIZE = 64;
51
- /**
52
- * normalize a private key
53
- * A private key is a 32-byte array.
54
- * But there are two different formats for private keys:
55
- * 1. A 32-byte array
56
- * 2. A 64-byte array with the first 32 bytes being the private key and the last 32 bytes being the public key
57
- * 3. A 33-byte array with the first byte being 0x00 (sui.keystore key is a Base64 string with scheme flag 0x00 at the beginning)
58
- */
59
- export const normalizePrivateKey = (key: Uint8Array): Uint8Array => {
60
- if (key.length === LEGACY_PRIVATE_KEY_SIZE) {
61
- // This is a legacy secret key, we need to strip the public key bytes and only read the first 32 bytes
62
- key = key.slice(0, PRIVATE_KEY_SIZE);
63
- } else if (key.length === PRIVATE_KEY_SIZE + 1 && key[0] === 0) {
64
- // sui.keystore key is a Base64 string with scheme flag 0x00 at the beginning
65
- return key.slice(1);
66
- } else if (key.length === PRIVATE_KEY_SIZE) {
67
- return key;
68
- }
69
- throw new Error('invalid secret key');
70
- };
@@ -1,120 +0,0 @@
1
- import { SuiMoveNormalizedModules} from '@mysten/sui.js';
2
- import type { ContractFactoryParams, SuiMoveMoudleValueType } from './types';
3
- export type ApiTypes = 'promise' | 'rxjs';
4
-
5
- // export interface ContractQuery {
6
- // (origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: unknown[]): SuiTransactionBlockResponse<ApiType, ContractCallOutcome>;
7
- // }
8
-
9
- // export type MapMessageQuery<ApiType extends ApiTypes> = Record<string, ContractQuery<ApiType>>;
10
-
11
- // // function createQuery <ApiType extends ApiTypes> (meta: AbiMessage, fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: unknown[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
12
- // // return withMeta(meta, (origin: string | AccountId | Uint8Array, options: ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome> =>
13
- // // fn(origin, options, params)
14
- // // );
15
- // // }
16
-
17
- // export type MapMessageTx<ApiType extends ApiTypes> = Record<string, ContractTx<ApiType>>;
18
-
19
- // export interface ContractOptions {
20
- // gasLimit?: bigint | string | number | BN | WeightV2;
21
- // storageDepositLimit?: bigint | string | number | BN | null;
22
- // value?: bigint | BN | string | number;
23
- // }
24
-
25
- // export interface ContractTx {
26
- // (options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
27
- // }
28
- export class SuiContractFactory {
29
- public packageId: string;
30
- public metadata: SuiMoveNormalizedModules | undefined;
31
- // readonly #query: MapMessageQuery<ApiTypes> = {};
32
- // readonly #tx: MapMessageTx<ApiTypes> = {};
33
- /**
34
- * Support the following ways to init the SuiToolkit:
35
- * 1. mnemonics
36
- * 2. secretKey (base64 or hex)
37
- * If none of them is provided, will generate a random mnemonics with 24 words.
38
- *
39
- * @param mnemonics, 12 or 24 mnemonics words, separated by space
40
- * @param secretKey, base64 or hex string, when mnemonics is provided, secretKey will be ignored
41
- */
42
- constructor({ packageId, metadata }: ContractFactoryParams = {}) {
43
- // If the mnemonics or secretKey is provided, use it
44
- // Otherwise, generate a random mnemonics with 24 words
45
- this.packageId = packageId || '';
46
- this.metadata = metadata || undefined;
47
- }
48
-
49
- getFuncByModuleName(moduleName: string) {
50
- Object.values(this.metadata as SuiMoveNormalizedModules).forEach(
51
- (value) => {
52
- const data = value as SuiMoveMoudleValueType;
53
- console.log(`moudle name: ${data.name}`);
54
- // console.log(data.exposedFunctions)
55
- Object.entries(data.exposedFunctions).forEach(([key, value]) => {
56
- console.log(`\tfunc name: ${key}`);
57
- Object.values(value.parameters).forEach((values) => {
58
- // console.log(values)
59
- });
60
- });
61
- }
62
- );
63
- }
64
-
65
- getAllFunc() {
66
- Object.values(this.metadata as SuiMoveNormalizedModules).forEach(
67
- (value) => {
68
- const data = value as SuiMoveMoudleValueType;
69
- console.log(`moudle name: ${data.name}`);
70
- // console.log(data.exposedFunctions)
71
- Object.entries(data.exposedFunctions).forEach(([key, value]) => {
72
- console.log(`\tfunc name: ${key}`);
73
- console.log(`\t\t${value.parameters.length}`);
74
- Object.values(value.parameters).forEach((values) => {
75
- // console.log(values)
76
- console.log(`\t\targs: ${values}`);
77
- });
78
- });
79
- }
80
- );
81
- }
82
-
83
- getAllModule() {
84
- Object.values(this.metadata as SuiMoveNormalizedModules).forEach(
85
- (value, index) => {
86
- const data = value as SuiMoveMoudleValueType;
87
- console.log(`${index}. ${data.name}`);
88
- }
89
- );
90
- }
91
-
92
- // async call(arguments: ({
93
- // kind: "Input";
94
- // index: number;
95
- // type?: "object" | "pure" | undefined;
96
- // value?: any;
97
- // } | {
98
- // kind: "GasCoin";
99
- // } | {
100
- // kind: "Result";
101
- // index: number;
102
- // } | {
103
- // kind: "NestedResult";
104
- // index: number;
105
- // resultIndex: number;
106
- // })[], derivePathParams?: DerivePathParams) {
107
- // const tx = new TransactionBlock();
108
- // tx.moveCall({
109
- // target: `${this.packageId}::${}::${}`,
110
- // arguments,
111
- // })
112
- // return ;
113
- // }
114
- }
115
-
116
- // function createTx <ApiType extends ApiTypes> (meta: AbiMessage, fn: (options: ContractOptions, params: unknown[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
117
- // return withMeta(meta, (options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType> =>
118
- // fn(options, params)
119
- // );
120
- // }
@@ -1,54 +0,0 @@
1
- import { SuiMoveNormalizedModules, SuiMoveNormalizedType } from "@mysten/sui.js";
2
-
3
- export type ContractFactoryParams = {
4
- packageId?: string;
5
- metadata?: SuiMoveNormalizedModules;
6
- };
7
-
8
-
9
- export type SuiMoveMoudleValueType = {
10
- address: string;
11
- name: string;
12
- fileFormatVersion: number;
13
- friends: {
14
- address: string;
15
- name: string;
16
- }[];
17
- structs: Record<string, {
18
- fields: {
19
- type: SuiMoveNormalizedType;
20
- name: string;
21
- }[];
22
- abilities: {
23
- abilities: string[];
24
- };
25
- typeParameters: {
26
- constraints: {
27
- abilities: string[];
28
- };
29
- isPhantom: boolean;
30
- }[];
31
- }>;
32
- exposedFunctions: Record<string, {
33
- visibility: "Private" | "Public" | "Friend";
34
- isEntry: boolean;
35
- typeParameters: {
36
- abilities: string[];
37
- }[];
38
- parameters: SuiMoveNormalizedType[];
39
- return: SuiMoveNormalizedType[];
40
- }>;
41
- }
42
-
43
-
44
- export type SuiMoveMoudleFuncType = {
45
- moudleName: string,
46
- funcName: string,
47
- visibility: "Private" | "Public" | "Friend";
48
- isEntry: boolean;
49
- typeParameters: {
50
- abilities: string[];
51
- }[];
52
- parameters: SuiMoveNormalizedType[];
53
- return: SuiMoveNormalizedType[];
54
- }
@@ -1,32 +0,0 @@
1
- import {
2
- localnetConnection,
3
- devnetConnection,
4
- testnetConnection,
5
- mainnetConnection,
6
- } from '@mysten/sui.js';
7
- import type { Connection } from '@mysten/sui.js';
8
- import type { NetworkType } from '../../types';
9
- export const defaultGasBudget = 10 ** 8; // 0.1 SUI, should be enough for most of the transactions
10
- export const defaultGasPrice = 1000; // 1000 MIST
11
-
12
- /**
13
- * @description Get the default fullnode url and faucet url for the given network type
14
- * @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'devnet'
15
- * @returns { fullNode: string, websocket: string, faucet?: string }
16
- */
17
- export const getDefaultConnection = (
18
- networkType: NetworkType = 'devnet'
19
- ): Connection => {
20
- switch (networkType) {
21
- case 'localnet':
22
- return localnetConnection;
23
- case 'devnet':
24
- return devnetConnection;
25
- case 'testnet':
26
- return testnetConnection;
27
- case 'mainnet':
28
- return mainnetConnection;
29
- default:
30
- return devnetConnection;
31
- }
32
- };
@@ -1,2 +0,0 @@
1
- export { SuiInteractor } from './suiInteractor';
2
- export { getDefaultConnection } from './defaultConfig';