@vleap/warps-adapter-fastset 0.1.0-alpha.6 → 0.1.0-alpha.8
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.
- package/dist/index.d.mts +97 -77
- package/dist/index.d.ts +97 -77
- package/dist/index.js +3 -121
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -121
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdapterFactory,
|
|
1
|
+
import { AdapterFactory, AdapterWarpExecutor, WarpClientConfig, WarpExecutable, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
|
|
2
2
|
import * as _mysten_bcs from '@mysten/bcs';
|
|
3
3
|
|
|
4
4
|
declare const WarpFastsetConstants: {
|
|
@@ -38,76 +38,117 @@ declare const getFastsetAdapter: AdapterFactory;
|
|
|
38
38
|
|
|
39
39
|
declare const Bytes32: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
40
40
|
length: number;
|
|
41
|
-
}
|
|
41
|
+
}>;
|
|
42
42
|
declare const PublicKey: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
43
43
|
length: number;
|
|
44
|
-
}
|
|
45
|
-
declare const Address: _mysten_bcs.
|
|
46
|
-
External:
|
|
44
|
+
}>;
|
|
45
|
+
declare const Address: _mysten_bcs.BcsType<{
|
|
46
|
+
External: number[];
|
|
47
|
+
} | {
|
|
48
|
+
FastSet: number[];
|
|
49
|
+
}, {
|
|
50
|
+
External: Iterable<number> & {
|
|
47
51
|
length: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
FastSet: Iterable<number> & {
|
|
50
55
|
length: number;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
declare const Amount: _mysten_bcs.BcsType<string, unknown
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
declare const Amount: _mysten_bcs.BcsType<string, unknown>;
|
|
54
59
|
declare const UserData: _mysten_bcs.BcsType<number[] | null, (Iterable<number> & {
|
|
55
60
|
length: number;
|
|
56
|
-
}) | null | undefined
|
|
57
|
-
declare const Nonce: _mysten_bcs.BcsType<string, string | number | bigint
|
|
58
|
-
declare const Transfer: _mysten_bcs.
|
|
59
|
-
recipient:
|
|
60
|
-
External:
|
|
61
|
+
}) | null | undefined>;
|
|
62
|
+
declare const Nonce: _mysten_bcs.BcsType<string, string | number | bigint>;
|
|
63
|
+
declare const Transfer: _mysten_bcs.BcsType<{
|
|
64
|
+
recipient: {
|
|
65
|
+
External: number[];
|
|
66
|
+
} | {
|
|
67
|
+
FastSet: number[];
|
|
68
|
+
};
|
|
69
|
+
amount: string;
|
|
70
|
+
user_data: number[] | null;
|
|
71
|
+
}, {
|
|
72
|
+
recipient: {
|
|
73
|
+
External: Iterable<number> & {
|
|
61
74
|
length: number;
|
|
62
|
-
}
|
|
63
|
-
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
FastSet: Iterable<number> & {
|
|
64
78
|
length: number;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
amount:
|
|
68
|
-
user_data:
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
amount: unknown;
|
|
82
|
+
user_data: (Iterable<number> & {
|
|
69
83
|
length: number;
|
|
70
|
-
}) | null | undefined
|
|
71
|
-
}
|
|
72
|
-
declare const ClaimType: _mysten_bcs.
|
|
73
|
-
Transfer:
|
|
74
|
-
recipient:
|
|
75
|
-
External:
|
|
84
|
+
}) | null | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
declare const ClaimType: _mysten_bcs.BcsType<{
|
|
87
|
+
Transfer: {
|
|
88
|
+
recipient: {
|
|
89
|
+
External: number[];
|
|
90
|
+
} | {
|
|
91
|
+
FastSet: number[];
|
|
92
|
+
};
|
|
93
|
+
amount: string;
|
|
94
|
+
user_data: number[] | null;
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
Transfer: {
|
|
98
|
+
recipient: {
|
|
99
|
+
External: Iterable<number> & {
|
|
76
100
|
length: number;
|
|
77
|
-
}
|
|
78
|
-
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
FastSet: Iterable<number> & {
|
|
79
104
|
length: number;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
amount:
|
|
83
|
-
user_data:
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
amount: unknown;
|
|
108
|
+
user_data: (Iterable<number> & {
|
|
84
109
|
length: number;
|
|
85
|
-
}) | null | undefined
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
declare const Transaction: _mysten_bcs.
|
|
89
|
-
sender:
|
|
110
|
+
}) | null | undefined;
|
|
111
|
+
};
|
|
112
|
+
}>;
|
|
113
|
+
declare const Transaction: _mysten_bcs.BcsType<{
|
|
114
|
+
sender: number[];
|
|
115
|
+
nonce: string;
|
|
116
|
+
timestamp_nanos: string;
|
|
117
|
+
claim: {
|
|
118
|
+
Transfer: {
|
|
119
|
+
recipient: {
|
|
120
|
+
External: number[];
|
|
121
|
+
} | {
|
|
122
|
+
FastSet: number[];
|
|
123
|
+
};
|
|
124
|
+
amount: string;
|
|
125
|
+
user_data: number[] | null;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}, {
|
|
129
|
+
sender: Iterable<number> & {
|
|
90
130
|
length: number;
|
|
91
|
-
}
|
|
92
|
-
nonce:
|
|
93
|
-
timestamp_nanos:
|
|
94
|
-
claim:
|
|
95
|
-
Transfer:
|
|
96
|
-
recipient:
|
|
97
|
-
External:
|
|
131
|
+
};
|
|
132
|
+
nonce: string | number | bigint;
|
|
133
|
+
timestamp_nanos: string | number | bigint;
|
|
134
|
+
claim: {
|
|
135
|
+
Transfer: {
|
|
136
|
+
recipient: {
|
|
137
|
+
External: Iterable<number> & {
|
|
98
138
|
length: number;
|
|
99
|
-
}
|
|
100
|
-
|
|
139
|
+
};
|
|
140
|
+
} | {
|
|
141
|
+
FastSet: Iterable<number> & {
|
|
101
142
|
length: number;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
amount:
|
|
105
|
-
user_data:
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
amount: unknown;
|
|
146
|
+
user_data: (Iterable<number> & {
|
|
106
147
|
length: number;
|
|
107
|
-
}) | null | undefined
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
148
|
+
}) | null | undefined;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
}>;
|
|
111
152
|
interface FastsetTransaction {
|
|
112
153
|
sender: Uint8Array;
|
|
113
154
|
nonce: number;
|
|
@@ -204,27 +245,6 @@ declare function normalizeAmount(amount: string): string;
|
|
|
204
245
|
declare function validatePrivateKey(privateKey: string | Uint8Array): boolean;
|
|
205
246
|
declare function validatePublicKey(publicKey: string | Uint8Array): boolean;
|
|
206
247
|
|
|
207
|
-
declare class WarpFastsetBuilder implements CombinedWarpBuilder {
|
|
208
|
-
private readonly config;
|
|
209
|
-
private warp;
|
|
210
|
-
private actions;
|
|
211
|
-
constructor(config: WarpClientConfig);
|
|
212
|
-
createFromRaw(encoded: string): Promise<Warp>;
|
|
213
|
-
setTitle(title: string): BaseWarpBuilder;
|
|
214
|
-
setDescription(description: string): BaseWarpBuilder;
|
|
215
|
-
setPreview(preview: string): BaseWarpBuilder;
|
|
216
|
-
setActions(actions: WarpAction[]): BaseWarpBuilder;
|
|
217
|
-
addAction(action: WarpAction): BaseWarpBuilder;
|
|
218
|
-
build(): Promise<Warp>;
|
|
219
|
-
createInscriptionTransaction(warp: Warp): any;
|
|
220
|
-
createFromTransaction(tx: any, validate?: boolean): Promise<Warp>;
|
|
221
|
-
createFromTransactionHash(hash: string, cache?: any): Promise<Warp | null>;
|
|
222
|
-
private generateHash;
|
|
223
|
-
private validateWarp;
|
|
224
|
-
private fetchTransaction;
|
|
225
|
-
private getApiUrl;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
248
|
declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
229
249
|
private readonly config;
|
|
230
250
|
private readonly serializer;
|
|
@@ -280,4 +300,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
|
280
300
|
stringToTyped(value: string): any;
|
|
281
301
|
}
|
|
282
302
|
|
|
283
|
-
export { Address, Amount, Bytes32, ClaimType, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransferRequest, Nonce, PublicKey, Transaction, Transfer, UserData,
|
|
303
|
+
export { Address, Amount, Bytes32, ClaimType, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransferRequest, Nonce, PublicKey, Transaction, Transfer, UserData, WarpFastsetConstants, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, decimalToHex, fromBase64, getFastsetAdapter, hexToDecimal, isValidFastsetAddress, normalizeAmount, toBase64String, toHexString, validateAmount, validatePrivateKey, validatePublicKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdapterFactory,
|
|
1
|
+
import { AdapterFactory, AdapterWarpExecutor, WarpClientConfig, WarpExecutable, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
|
|
2
2
|
import * as _mysten_bcs from '@mysten/bcs';
|
|
3
3
|
|
|
4
4
|
declare const WarpFastsetConstants: {
|
|
@@ -38,76 +38,117 @@ declare const getFastsetAdapter: AdapterFactory;
|
|
|
38
38
|
|
|
39
39
|
declare const Bytes32: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
40
40
|
length: number;
|
|
41
|
-
}
|
|
41
|
+
}>;
|
|
42
42
|
declare const PublicKey: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
43
43
|
length: number;
|
|
44
|
-
}
|
|
45
|
-
declare const Address: _mysten_bcs.
|
|
46
|
-
External:
|
|
44
|
+
}>;
|
|
45
|
+
declare const Address: _mysten_bcs.BcsType<{
|
|
46
|
+
External: number[];
|
|
47
|
+
} | {
|
|
48
|
+
FastSet: number[];
|
|
49
|
+
}, {
|
|
50
|
+
External: Iterable<number> & {
|
|
47
51
|
length: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
FastSet: Iterable<number> & {
|
|
50
55
|
length: number;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
declare const Amount: _mysten_bcs.BcsType<string, unknown
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
declare const Amount: _mysten_bcs.BcsType<string, unknown>;
|
|
54
59
|
declare const UserData: _mysten_bcs.BcsType<number[] | null, (Iterable<number> & {
|
|
55
60
|
length: number;
|
|
56
|
-
}) | null | undefined
|
|
57
|
-
declare const Nonce: _mysten_bcs.BcsType<string, string | number | bigint
|
|
58
|
-
declare const Transfer: _mysten_bcs.
|
|
59
|
-
recipient:
|
|
60
|
-
External:
|
|
61
|
+
}) | null | undefined>;
|
|
62
|
+
declare const Nonce: _mysten_bcs.BcsType<string, string | number | bigint>;
|
|
63
|
+
declare const Transfer: _mysten_bcs.BcsType<{
|
|
64
|
+
recipient: {
|
|
65
|
+
External: number[];
|
|
66
|
+
} | {
|
|
67
|
+
FastSet: number[];
|
|
68
|
+
};
|
|
69
|
+
amount: string;
|
|
70
|
+
user_data: number[] | null;
|
|
71
|
+
}, {
|
|
72
|
+
recipient: {
|
|
73
|
+
External: Iterable<number> & {
|
|
61
74
|
length: number;
|
|
62
|
-
}
|
|
63
|
-
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
FastSet: Iterable<number> & {
|
|
64
78
|
length: number;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
amount:
|
|
68
|
-
user_data:
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
amount: unknown;
|
|
82
|
+
user_data: (Iterable<number> & {
|
|
69
83
|
length: number;
|
|
70
|
-
}) | null | undefined
|
|
71
|
-
}
|
|
72
|
-
declare const ClaimType: _mysten_bcs.
|
|
73
|
-
Transfer:
|
|
74
|
-
recipient:
|
|
75
|
-
External:
|
|
84
|
+
}) | null | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
declare const ClaimType: _mysten_bcs.BcsType<{
|
|
87
|
+
Transfer: {
|
|
88
|
+
recipient: {
|
|
89
|
+
External: number[];
|
|
90
|
+
} | {
|
|
91
|
+
FastSet: number[];
|
|
92
|
+
};
|
|
93
|
+
amount: string;
|
|
94
|
+
user_data: number[] | null;
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
Transfer: {
|
|
98
|
+
recipient: {
|
|
99
|
+
External: Iterable<number> & {
|
|
76
100
|
length: number;
|
|
77
|
-
}
|
|
78
|
-
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
FastSet: Iterable<number> & {
|
|
79
104
|
length: number;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
amount:
|
|
83
|
-
user_data:
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
amount: unknown;
|
|
108
|
+
user_data: (Iterable<number> & {
|
|
84
109
|
length: number;
|
|
85
|
-
}) | null | undefined
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
declare const Transaction: _mysten_bcs.
|
|
89
|
-
sender:
|
|
110
|
+
}) | null | undefined;
|
|
111
|
+
};
|
|
112
|
+
}>;
|
|
113
|
+
declare const Transaction: _mysten_bcs.BcsType<{
|
|
114
|
+
sender: number[];
|
|
115
|
+
nonce: string;
|
|
116
|
+
timestamp_nanos: string;
|
|
117
|
+
claim: {
|
|
118
|
+
Transfer: {
|
|
119
|
+
recipient: {
|
|
120
|
+
External: number[];
|
|
121
|
+
} | {
|
|
122
|
+
FastSet: number[];
|
|
123
|
+
};
|
|
124
|
+
amount: string;
|
|
125
|
+
user_data: number[] | null;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}, {
|
|
129
|
+
sender: Iterable<number> & {
|
|
90
130
|
length: number;
|
|
91
|
-
}
|
|
92
|
-
nonce:
|
|
93
|
-
timestamp_nanos:
|
|
94
|
-
claim:
|
|
95
|
-
Transfer:
|
|
96
|
-
recipient:
|
|
97
|
-
External:
|
|
131
|
+
};
|
|
132
|
+
nonce: string | number | bigint;
|
|
133
|
+
timestamp_nanos: string | number | bigint;
|
|
134
|
+
claim: {
|
|
135
|
+
Transfer: {
|
|
136
|
+
recipient: {
|
|
137
|
+
External: Iterable<number> & {
|
|
98
138
|
length: number;
|
|
99
|
-
}
|
|
100
|
-
|
|
139
|
+
};
|
|
140
|
+
} | {
|
|
141
|
+
FastSet: Iterable<number> & {
|
|
101
142
|
length: number;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
amount:
|
|
105
|
-
user_data:
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
amount: unknown;
|
|
146
|
+
user_data: (Iterable<number> & {
|
|
106
147
|
length: number;
|
|
107
|
-
}) | null | undefined
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
148
|
+
}) | null | undefined;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
}>;
|
|
111
152
|
interface FastsetTransaction {
|
|
112
153
|
sender: Uint8Array;
|
|
113
154
|
nonce: number;
|
|
@@ -204,27 +245,6 @@ declare function normalizeAmount(amount: string): string;
|
|
|
204
245
|
declare function validatePrivateKey(privateKey: string | Uint8Array): boolean;
|
|
205
246
|
declare function validatePublicKey(publicKey: string | Uint8Array): boolean;
|
|
206
247
|
|
|
207
|
-
declare class WarpFastsetBuilder implements CombinedWarpBuilder {
|
|
208
|
-
private readonly config;
|
|
209
|
-
private warp;
|
|
210
|
-
private actions;
|
|
211
|
-
constructor(config: WarpClientConfig);
|
|
212
|
-
createFromRaw(encoded: string): Promise<Warp>;
|
|
213
|
-
setTitle(title: string): BaseWarpBuilder;
|
|
214
|
-
setDescription(description: string): BaseWarpBuilder;
|
|
215
|
-
setPreview(preview: string): BaseWarpBuilder;
|
|
216
|
-
setActions(actions: WarpAction[]): BaseWarpBuilder;
|
|
217
|
-
addAction(action: WarpAction): BaseWarpBuilder;
|
|
218
|
-
build(): Promise<Warp>;
|
|
219
|
-
createInscriptionTransaction(warp: Warp): any;
|
|
220
|
-
createFromTransaction(tx: any, validate?: boolean): Promise<Warp>;
|
|
221
|
-
createFromTransactionHash(hash: string, cache?: any): Promise<Warp | null>;
|
|
222
|
-
private generateHash;
|
|
223
|
-
private validateWarp;
|
|
224
|
-
private fetchTransaction;
|
|
225
|
-
private getApiUrl;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
248
|
declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
229
249
|
private readonly config;
|
|
230
250
|
private readonly serializer;
|
|
@@ -280,4 +300,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
|
280
300
|
stringToTyped(value: string): any;
|
|
281
301
|
}
|
|
282
302
|
|
|
283
|
-
export { Address, Amount, Bytes32, ClaimType, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransferRequest, Nonce, PublicKey, Transaction, Transfer, UserData,
|
|
303
|
+
export { Address, Amount, Bytes32, ClaimType, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransferRequest, Nonce, PublicKey, Transaction, Transfer, UserData, WarpFastsetConstants, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, decimalToHex, fromBase64, getFastsetAdapter, hexToDecimal, isValidFastsetAddress, normalizeAmount, toBase64String, toHexString, validateAmount, validatePrivateKey, validatePublicKey };
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,6 @@ __export(index_exports, {
|
|
|
30
30
|
Transaction: () => Transaction,
|
|
31
31
|
Transfer: () => Transfer,
|
|
32
32
|
UserData: () => UserData,
|
|
33
|
-
WarpFastsetBuilder: () => WarpFastsetBuilder,
|
|
34
33
|
WarpFastsetConstants: () => WarpFastsetConstants,
|
|
35
34
|
WarpFastsetExecutor: () => WarpFastsetExecutor,
|
|
36
35
|
WarpFastsetExplorer: () => WarpFastsetExplorer,
|
|
@@ -91,122 +90,6 @@ var WarpFastsetConstants = {
|
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
92
|
|
|
94
|
-
// src/WarpFastsetBuilder.ts
|
|
95
|
-
var WarpFastsetBuilder = class {
|
|
96
|
-
constructor(config) {
|
|
97
|
-
this.config = config;
|
|
98
|
-
this.warp = {};
|
|
99
|
-
this.actions = [];
|
|
100
|
-
}
|
|
101
|
-
async createFromRaw(encoded) {
|
|
102
|
-
try {
|
|
103
|
-
const parsed = JSON.parse(encoded);
|
|
104
|
-
this.warp = parsed;
|
|
105
|
-
this.actions = parsed.actions || [];
|
|
106
|
-
return this.build();
|
|
107
|
-
} catch (error) {
|
|
108
|
-
throw new Error(`Failed to parse Fastset warp data: ${error}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
setTitle(title) {
|
|
112
|
-
this.warp.title = title;
|
|
113
|
-
return this;
|
|
114
|
-
}
|
|
115
|
-
setDescription(description) {
|
|
116
|
-
this.warp.description = description;
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
setPreview(preview) {
|
|
120
|
-
this.warp.preview = preview;
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
setActions(actions) {
|
|
124
|
-
this.actions = actions;
|
|
125
|
-
return this;
|
|
126
|
-
}
|
|
127
|
-
addAction(action) {
|
|
128
|
-
this.actions.push(action);
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
async build() {
|
|
132
|
-
return {
|
|
133
|
-
protocol: "warp",
|
|
134
|
-
name: this.warp.name || "fastset-warp",
|
|
135
|
-
title: this.warp.title || "",
|
|
136
|
-
description: this.warp.description || null,
|
|
137
|
-
preview: this.warp.preview || null,
|
|
138
|
-
actions: this.actions,
|
|
139
|
-
meta: {
|
|
140
|
-
chain: "fastset",
|
|
141
|
-
hash: this.generateHash(this.warp.title || ""),
|
|
142
|
-
creator: this.config.user?.wallets?.fastset || "",
|
|
143
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
createInscriptionTransaction(warp) {
|
|
148
|
-
return {
|
|
149
|
-
type: "fastset-inscription",
|
|
150
|
-
data: JSON.stringify(warp)
|
|
151
|
-
// TODO: Add Fastset-specific transaction fields
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
async createFromTransaction(tx, validate = true) {
|
|
155
|
-
try {
|
|
156
|
-
const warpData = tx.data || tx.payload || tx.content;
|
|
157
|
-
if (!warpData) {
|
|
158
|
-
throw new Error("No warp data found in transaction");
|
|
159
|
-
}
|
|
160
|
-
const parsed = typeof warpData === "string" ? JSON.parse(warpData) : warpData;
|
|
161
|
-
if (validate) {
|
|
162
|
-
this.validateWarp(parsed);
|
|
163
|
-
}
|
|
164
|
-
return parsed;
|
|
165
|
-
} catch (error) {
|
|
166
|
-
throw new Error(`Failed to create warp from Fastset transaction: ${error}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async createFromTransactionHash(hash, cache) {
|
|
170
|
-
try {
|
|
171
|
-
const tx = await this.fetchTransaction(hash);
|
|
172
|
-
if (!tx) {
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
return this.createFromTransaction(tx);
|
|
176
|
-
} catch (error) {
|
|
177
|
-
console.error(`Failed to create warp from Fastset transaction hash: ${error}`);
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
generateHash(data) {
|
|
182
|
-
let hash = 0;
|
|
183
|
-
for (let i = 0; i < data.length; i++) {
|
|
184
|
-
const char = data.charCodeAt(i);
|
|
185
|
-
hash = (hash << 5) - hash + char;
|
|
186
|
-
hash = hash & hash;
|
|
187
|
-
}
|
|
188
|
-
return hash.toString(16);
|
|
189
|
-
}
|
|
190
|
-
validateWarp(warp) {
|
|
191
|
-
if (!warp.title) {
|
|
192
|
-
throw new Error("Warp must have a title");
|
|
193
|
-
}
|
|
194
|
-
if (!warp.actions || !Array.isArray(warp.actions)) {
|
|
195
|
-
throw new Error("Warp must have actions array");
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
async fetchTransaction(hash) {
|
|
199
|
-
const response = await fetch(`${this.getApiUrl()}/transaction/${hash}`);
|
|
200
|
-
if (!response.ok) {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
return response.json();
|
|
204
|
-
}
|
|
205
|
-
getApiUrl() {
|
|
206
|
-
return "https://api.fastset.xyz";
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
93
|
// src/WarpFastsetDataLoader.ts
|
|
211
94
|
var WarpFastsetDataLoader = class {
|
|
212
95
|
constructor(config, chain) {
|
|
@@ -464,10 +347,10 @@ function fromBase64(base64) {
|
|
|
464
347
|
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
465
348
|
}
|
|
466
349
|
function toBase64String(bytes) {
|
|
467
|
-
return (0, import_bcs2.
|
|
350
|
+
return (0, import_bcs2.toB64)(bytes);
|
|
468
351
|
}
|
|
469
352
|
function toHexString(bytes) {
|
|
470
|
-
return (0, import_bcs2.
|
|
353
|
+
return (0, import_bcs2.toHEX)(bytes);
|
|
471
354
|
}
|
|
472
355
|
function hexToDecimal2(hex) {
|
|
473
356
|
return BigInt(`0x${hex}`).toString();
|
|
@@ -927,7 +810,7 @@ var getFastsetAdapter = (config, fallback) => {
|
|
|
927
810
|
chain: ChainName,
|
|
928
811
|
chainInfo,
|
|
929
812
|
prefix: "fastset",
|
|
930
|
-
builder: () =>
|
|
813
|
+
builder: () => fallback.builder(),
|
|
931
814
|
executor: new WarpFastsetExecutor(config),
|
|
932
815
|
results: new WarpFastsetResults(config),
|
|
933
816
|
serializer: new WarpFastsetSerializer(),
|
|
@@ -950,7 +833,6 @@ var getFastsetAdapter = (config, fallback) => {
|
|
|
950
833
|
Transaction,
|
|
951
834
|
Transfer,
|
|
952
835
|
UserData,
|
|
953
|
-
WarpFastsetBuilder,
|
|
954
836
|
WarpFastsetConstants,
|
|
955
837
|
WarpFastsetExecutor,
|
|
956
838
|
WarpFastsetExplorer,
|