@pendle/sdk-boros 1.6.0 → 1.6.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @pendle/sdk-boros
|
|
2
2
|
|
|
3
|
+
## 1.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 037253e: Reconcile the OTC bond EIP-712 types with the redesigned on-chain OTC module. **Breaking for anyone building `ExecuteOTCTradeMessage`:**
|
|
8
|
+
|
|
9
|
+
- `ExecuteOTCTradeMessage.makerExtract` → `makerBondConsume`, `takerExtract` → `takerBondConsume` (both `EXECUTE_OTC_TRADE_MESSAGE_TYPES` and the TS interface).
|
|
10
|
+
|
|
11
|
+
EIP-712 hashes the field **names**, so a stale name does not fail to compile against the contract — it produces a silently different typehash, a valid-looking signature, and a revert at execution time. Rename the fields at every construction site; do not rely on TypeScript alone to find them (an object literal widened to `Record<string, unknown>` or built from backend JSON will pass type-check and still sign the wrong struct).
|
|
12
|
+
|
|
13
|
+
A slash is no longer a distinct message: the contract has no `slashOTCBond`. Both a refund and a slash are `releaseOTCBond`, distinguished only by `receiver` (`== owner` refund, `!= owner` slash), and that message is signed by the validator, not by an agent — the SDK does not build it.
|
|
14
|
+
|
|
15
|
+
## 1.6.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 7816316: `signLockBondMessageWithAgent`: `nonce` is now optional. When omitted, it draws from the shared per-agent monotonic allocator (`allocateNonceBase`) — the same one the order path uses via `bulkSignWithAgent` — so a bond lock can't pick a value that collides with the agent's other in-flight txs, and the FE bond path no longer has to touch the nonce. The allocated value is returned as `nonce` on the result. Passing an explicit `nonce` is unchanged.
|
|
20
|
+
|
|
3
21
|
## 1.6.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -39,7 +39,7 @@ export declare const EXECUTE_OTC_TRADE_MESSAGE_TYPES: readonly [{
|
|
|
39
39
|
readonly name: "makerBondId";
|
|
40
40
|
readonly type: "bytes32";
|
|
41
41
|
}, {
|
|
42
|
-
readonly name: "
|
|
42
|
+
readonly name: "makerBondConsume";
|
|
43
43
|
readonly type: "uint256";
|
|
44
44
|
}, {
|
|
45
45
|
readonly name: "takerMsgHash";
|
|
@@ -48,7 +48,7 @@ export declare const EXECUTE_OTC_TRADE_MESSAGE_TYPES: readonly [{
|
|
|
48
48
|
readonly name: "takerBondId";
|
|
49
49
|
readonly type: "bytes32";
|
|
50
50
|
}, {
|
|
51
|
-
readonly name: "
|
|
51
|
+
readonly name: "takerBondConsume";
|
|
52
52
|
readonly type: "uint256";
|
|
53
53
|
}, {
|
|
54
54
|
readonly name: "expiry";
|
|
@@ -87,10 +87,10 @@ export interface AcceptOTCFullMessage {
|
|
|
87
87
|
export interface ExecuteOTCTradeMessage {
|
|
88
88
|
makerMsgHash: Hex;
|
|
89
89
|
makerBondId: Hex;
|
|
90
|
-
|
|
90
|
+
makerBondConsume: bigint;
|
|
91
91
|
takerMsgHash: Hex;
|
|
92
92
|
takerBondId: Hex;
|
|
93
|
-
|
|
93
|
+
takerBondConsume: bigint;
|
|
94
94
|
expiry: bigint;
|
|
95
95
|
}
|
|
96
96
|
export interface LockBondMessage {
|
|
@@ -123,10 +123,11 @@ export declare function signLockBondMessageWithAgent(params: {
|
|
|
123
123
|
tokenId: number;
|
|
124
124
|
bondId: Hex;
|
|
125
125
|
amount: bigint;
|
|
126
|
-
nonce
|
|
126
|
+
nonce?: bigint;
|
|
127
127
|
}): Promise<{
|
|
128
128
|
agent: Address;
|
|
129
129
|
signature: Hex;
|
|
130
|
+
nonce: bigint;
|
|
130
131
|
}>;
|
|
131
132
|
export interface P2pDealParams {
|
|
132
133
|
marketId: number;
|
|
@@ -13,6 +13,7 @@ exports.signCancelOTCTradeMessageWithAgent = signCancelOTCTradeMessageWithAgent;
|
|
|
13
13
|
const node_crypto_1 = require("node:crypto");
|
|
14
14
|
const viem_1 = require("viem");
|
|
15
15
|
const entities_1 = require("../../entities");
|
|
16
|
+
const agent_1 = require("./agent");
|
|
16
17
|
const common_1 = require("./common");
|
|
17
18
|
function generateOrderSalt() {
|
|
18
19
|
const saltBytes = (0, node_crypto_1.randomBytes)(32);
|
|
@@ -35,10 +36,10 @@ exports.ACCEPT_OTC_FULL_MESSAGE_TYPES = [
|
|
|
35
36
|
exports.EXECUTE_OTC_TRADE_MESSAGE_TYPES = [
|
|
36
37
|
{ name: 'makerMsgHash', type: 'bytes32' },
|
|
37
38
|
{ name: 'makerBondId', type: 'bytes32' },
|
|
38
|
-
{ name: '
|
|
39
|
+
{ name: 'makerBondConsume', type: 'uint256' },
|
|
39
40
|
{ name: 'takerMsgHash', type: 'bytes32' },
|
|
40
41
|
{ name: 'takerBondId', type: 'bytes32' },
|
|
41
|
-
{ name: '
|
|
42
|
+
{ name: 'takerBondConsume', type: 'uint256' },
|
|
42
43
|
{ name: 'expiry', type: 'uint64' },
|
|
43
44
|
];
|
|
44
45
|
exports.LOCK_BOND_MESSAGE_TYPES = [
|
|
@@ -111,6 +112,7 @@ async function signLockBondMessageWithAgent(params) {
|
|
|
111
112
|
const agent = (0, entities_1.getInternalAgent)();
|
|
112
113
|
const agentAddress = await agent.getAddress();
|
|
113
114
|
const signer = agent.walletClient;
|
|
115
|
+
const nonce = params.nonce ?? (await (0, agent_1.allocateNonceBase)(agentAddress.toLowerCase(), 1));
|
|
114
116
|
const signature = await signer.signTypedData({
|
|
115
117
|
account: agent.walletClient.account,
|
|
116
118
|
domain: (0, common_1.createPendleBorosRouterDomain)(),
|
|
@@ -124,10 +126,10 @@ async function signLockBondMessageWithAgent(params) {
|
|
|
124
126
|
tokenId: params.tokenId,
|
|
125
127
|
bondId: params.bondId,
|
|
126
128
|
amount: params.amount,
|
|
127
|
-
nonce
|
|
129
|
+
nonce,
|
|
128
130
|
},
|
|
129
131
|
});
|
|
130
|
-
return { agent: agentAddress, signature };
|
|
132
|
+
return { agent: agentAddress, signature, nonce };
|
|
131
133
|
}
|
|
132
134
|
const OTC_TRADE_REQ_TYPEHASH = (0, viem_1.keccak256)((0, viem_1.toHex)('OTCTradeReq(uint24 marketId,int128 signedSize,int128 rate,address maker,address taker,uint256 salt)'));
|
|
133
135
|
function buildP2pTrade(deal, offer) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otc.js","sourceRoot":"","sources":["../../../src/utils/signing/otc.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"otc.js","sourceRoot":"","sources":["../../../src/utils/signing/otc.ts"],"names":[],"mappings":";;;AAMA,8CAGC;AAgFD,4DAoBC;AAQD,8EAiCC;AAED,kDAUC;AAED,oEAkCC;AAiCD,sCAUC;AAID,8CAwBC;AAID,oCAEC;AAED,gFAmBC;AAxSD,6CAA0C;AAC1C,+BAA8G;AAC9G,6CAAkD;AAClD,mCAA4C;AAC5C,qCAA8E;AAE9E,SAAgB,iBAAiB;IAC/B,MAAM,SAAS,GAAG,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,KAAK,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAClD,CAAC;AAEY,QAAA,mBAAmB,GAAG;IACjC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;IACtC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;CACzB,CAAC;AAEE,QAAA,6BAA6B,GAAG;IAC3C,EAAE,IA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