@velumx/sdk 1.1.0 → 1.3.0
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/IntentBuilder.d.ts +1 -1
- package/dist/IntentBuilder.js +3 -5
- package/dist/VelumXClient.js +4 -3
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
- package/src/IntentBuilder.ts +5 -6
- package/src/VelumXClient.ts +4 -3
- package/src/types.ts +1 -2
package/dist/IntentBuilder.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class IntentBuilder {
|
|
|
10
10
|
private getDomain;
|
|
11
11
|
/**
|
|
12
12
|
* Formats the intent into a Clarity Tuple for signing
|
|
13
|
-
* Structure matches the Smart Wallet expectation
|
|
13
|
+
* Structure matches the Smart Wallet v4 expectation
|
|
14
14
|
*/
|
|
15
15
|
private formatIntentMessage;
|
|
16
16
|
/**
|
package/dist/IntentBuilder.js
CHANGED
|
@@ -20,16 +20,14 @@ class IntentBuilder {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Formats the intent into a Clarity Tuple for signing
|
|
23
|
-
* Structure matches the Smart Wallet expectation
|
|
23
|
+
* Structure matches the Smart Wallet v4 expectation
|
|
24
24
|
*/
|
|
25
25
|
formatIntentMessage(intent) {
|
|
26
26
|
return (0, transactions_1.tupleCV)({
|
|
27
27
|
target: (0, transactions_1.principalCV)(intent.target),
|
|
28
|
-
|
|
29
|
-
args: (0, transactions_1.listCV)(intent.args),
|
|
28
|
+
payload: (0, transactions_1.bufferCV)(Buffer.from(intent.payload.startsWith('0x') ? intent.payload.substring(2) : intent.payload, 'hex')),
|
|
30
29
|
'max-fee-usdcx': (0, transactions_1.uintCV)(intent.maxFeeUSDCx),
|
|
31
|
-
nonce: (0, transactions_1.uintCV)(intent.nonce)
|
|
32
|
-
deadline: intent.deadline ? (0, transactions_1.someCV)((0, transactions_1.uintCV)(intent.deadline)) : (0, transactions_1.noneCV)()
|
|
30
|
+
nonce: (0, transactions_1.uintCV)(intent.nonce)
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
/**
|
package/dist/VelumXClient.js
CHANGED
|
@@ -22,7 +22,8 @@ class VelumXClient {
|
|
|
22
22
|
body: JSON.stringify({ intent })
|
|
23
23
|
});
|
|
24
24
|
if (!response.ok) {
|
|
25
|
-
|
|
25
|
+
const errData = await response.json().catch(() => ({}));
|
|
26
|
+
throw new Error(`Fee estimation failed: ${errData.error || errData.message || response.statusText}`);
|
|
26
27
|
}
|
|
27
28
|
return await response.json();
|
|
28
29
|
}
|
|
@@ -47,7 +48,7 @@ class VelumXClient {
|
|
|
47
48
|
});
|
|
48
49
|
if (!response.ok) {
|
|
49
50
|
const errData = await response.json().catch(() => ({}));
|
|
50
|
-
throw new Error(`Intent sponsorship failed: ${errData.message || response.statusText}`);
|
|
51
|
+
throw new Error(`Intent sponsorship failed: ${errData.error || errData.message || response.statusText}`);
|
|
51
52
|
}
|
|
52
53
|
return await response.json();
|
|
53
54
|
}
|
|
@@ -72,7 +73,7 @@ class VelumXClient {
|
|
|
72
73
|
});
|
|
73
74
|
if (!response.ok) {
|
|
74
75
|
const errData = await response.json().catch(() => ({}));
|
|
75
|
-
throw new Error(`Transaction broadcast failed: ${errData.message || response.statusText}`);
|
|
76
|
+
throw new Error(`Transaction broadcast failed: ${errData.error || errData.message || response.statusText}`);
|
|
76
77
|
}
|
|
77
78
|
return await response.json();
|
|
78
79
|
}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/IntentBuilder.ts
CHANGED
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
stringAsciiCV,
|
|
7
7
|
noneCV,
|
|
8
8
|
someCV,
|
|
9
|
-
listCV
|
|
9
|
+
listCV,
|
|
10
|
+
bufferCV
|
|
10
11
|
} from '@stacks/transactions';
|
|
11
12
|
import { WalletIntent, SignedIntent } from './types';
|
|
12
13
|
|
|
@@ -32,16 +33,14 @@ export class IntentBuilder {
|
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Formats the intent into a Clarity Tuple for signing
|
|
35
|
-
* Structure matches the Smart Wallet expectation
|
|
36
|
+
* Structure matches the Smart Wallet v4 expectation
|
|
36
37
|
*/
|
|
37
38
|
private formatIntentMessage(intent: WalletIntent) {
|
|
38
39
|
return tupleCV({
|
|
39
40
|
target: principalCV(intent.target),
|
|
40
|
-
'
|
|
41
|
-
args: listCV(intent.args),
|
|
41
|
+
payload: bufferCV(Buffer.from(intent.payload.startsWith('0x') ? intent.payload.substring(2) : intent.payload, 'hex')),
|
|
42
42
|
'max-fee-usdcx': uintCV(intent.maxFeeUSDCx),
|
|
43
|
-
nonce: uintCV(intent.nonce)
|
|
44
|
-
deadline: intent.deadline ? someCV(uintCV(intent.deadline)) : noneCV()
|
|
43
|
+
nonce: uintCV(intent.nonce)
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
|
package/src/VelumXClient.ts
CHANGED
|
@@ -27,7 +27,8 @@ export class VelumXClient {
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
if (!response.ok) {
|
|
30
|
-
|
|
30
|
+
const errData = await response.json().catch(() => ({}));
|
|
31
|
+
throw new Error(`Fee estimation failed: ${errData.error || errData.message || response.statusText}`);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
return await response.json();
|
|
@@ -55,7 +56,7 @@ export class VelumXClient {
|
|
|
55
56
|
|
|
56
57
|
if (!response.ok) {
|
|
57
58
|
const errData = await response.json().catch(() => ({}));
|
|
58
|
-
throw new Error(`Intent sponsorship failed: ${errData.message || response.statusText}`);
|
|
59
|
+
throw new Error(`Intent sponsorship failed: ${errData.error || errData.message || response.statusText}`);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
return await response.json();
|
|
@@ -83,7 +84,7 @@ export class VelumXClient {
|
|
|
83
84
|
|
|
84
85
|
if (!response.ok) {
|
|
85
86
|
const errData = await response.json().catch(() => ({}));
|
|
86
|
-
throw new Error(`Transaction broadcast failed: ${errData.message || response.statusText}`);
|
|
87
|
+
throw new Error(`Transaction broadcast failed: ${errData.error || errData.message || response.statusText}`);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
return await response.json();
|
package/src/types.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { principalCV, uintCV, stringAsciiCV, tupleCV, someCV, noneCV, ClarityVal
|
|
|
2
2
|
|
|
3
3
|
export interface WalletIntent {
|
|
4
4
|
target: string;
|
|
5
|
-
|
|
6
|
-
args: ClarityValue[];
|
|
5
|
+
payload: string; // Hex string of the encoded transaction
|
|
7
6
|
maxFeeUSDCx: string | number; // uint represented as string or number
|
|
8
7
|
nonce: string | number;
|
|
9
8
|
deadline?: string | number; // Future feature
|