@velumx/sdk 1.2.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/types.d.ts +1 -3
- package/package.json +1 -1
- package/src/IntentBuilder.ts +5 -6
- 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/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/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
|