@pendle/sdk-boros 0.1.36 → 0.1.38

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/README.md CHANGED
@@ -1,20 +1,36 @@
1
1
  # Pendle SDK Boros
2
2
 
3
- The `Exchange` class provides an interface for interacting with the Boros trading platform. It handles operations such as placing orders, modifying orders, managing positions, and interacting with the blockchain.
3
+ ## Overview
4
4
 
5
5
  Below is the documentation for the SDK. For more details about the overall architecture, contracts, API, and more, please refer to the [documentation](documentation/) folder.
6
6
 
7
+ The repository is organized as follows:
8
+
9
+ - [documentation](documentation/):
10
+ - [lite-paper](documentation/lite-paper.md): lite paper for how boros works
11
+ - [contracts-docs](documentation/contracts-docs/): contains the documentation to deep dive into the contracts, the overall architecture, and terminology
12
+ - [API.docs.md](documentation/API.docs.md): API documentation
13
+ - [SDK.docs.md](documentation/SDK.docs.md): SDK documentation
14
+ - [example](documentation/example/): example code for the SDK
15
+ - [src](src/): contains the source code of the SDK
16
+
7
17
  You can start with the [lite paper](documentation/lite-paper.md) to understand the overall architecture and mechanics of the platform.
18
+
8
19
  Then you can go to the [API docs](documentation/API.docs.md) to understand the API and parameters.
9
20
  After that, you can refer to [SDK docs](documentation/SDK.docs.md) and [example](documentation/example/) to see how to use the SDK.
10
21
 
11
22
  ## Installation
12
23
 
24
+ To use the SDK, you can install it using yarn. Our SDK is yet to be published to npm, so you need to config private credentials to install it. Can have a look at [.yarnrc.yml](.yarnrc.yml) for more details.
25
+
13
26
  ```bash
27
+ export PENDLE_SDK_BOROS_NPM_AUTH_TOKEN=<your-npm-auth-token>
28
+ # config your .yarnrc.yml follow our .yarnrc.yml file
29
+ # then install the package
14
30
  yarn add @pendle/sdk-boros
15
-
16
31
  ```
17
32
 
33
+
18
34
  ## Initialization
19
35
 
20
36
  ```typescript
@@ -1,4 +1,6 @@
1
- import { Hex, Log } from 'viem';
1
+ import { Hex, Log, PublicClient } from 'viem';
2
+ import { SimulateReturnType } from 'viem/actions';
3
+ import { SignedAgentExecution } from '../../utils';
2
4
  export declare function parseEvents(txHash: Hex): Promise<{
3
5
  hub: import("viem").ParseEventLogsReturnType<readonly [{
4
6
  readonly anonymous: false;
@@ -3600,3 +3602,5 @@ export declare function getTransactionData(txHash: Hex): Promise<{
3600
3602
  };
3601
3603
  } | null)[];
3602
3604
  }>;
3605
+ export declare function getAgentExecuteCalldata(query: SignedAgentExecution): Promise<`0x${string}`>;
3606
+ export declare function simulateDirectCall(publicClient: PublicClient, signedAgentExecution: SignedAgentExecution): Promise<SimulateReturnType>;
@@ -36,9 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.parseEvents = parseEvents;
37
37
  exports.decodeLog = decodeLog;
38
38
  exports.getTransactionData = getTransactionData;
39
+ exports.getAgentExecuteCalldata = getAgentExecuteCalldata;
40
+ exports.simulateDirectCall = simulateDirectCall;
39
41
  const viem_1 = require("viem");
40
42
  const Abis = __importStar(require("../../contracts/viemAbis"));
41
43
  const publicClient_1 = require("../publicClient");
44
+ const viemAbis_1 = require("../../contracts/viemAbis");
45
+ const addresses_1 = require("../../addresses");
42
46
  async function parseEvents(txHash) {
43
47
  const receipt = await publicClient_1.publicClient.waitForTransactionReceipt({ hash: txHash });
44
48
  return {
@@ -63,4 +67,33 @@ async function getTransactionData(txHash) {
63
67
  const decodedLogs = receipt.logs.map((log) => decodeLog(log));
64
68
  return { decodedLogs };
65
69
  }
70
+ async function getAgentExecuteCalldata(query) {
71
+ const calldata = (0, viem_1.encodeFunctionData)({
72
+ abi: viemAbis_1.iRouterAbi,
73
+ functionName: 'agentExecute',
74
+ args: [
75
+ query.agent,
76
+ {
77
+ account: query.message.account,
78
+ connectionId: query.message.connectionId,
79
+ nonce: BigInt(query.message.nonce),
80
+ },
81
+ query.signature,
82
+ query.calldata,
83
+ ],
84
+ });
85
+ return calldata;
86
+ }
87
+ async function simulateDirectCall(publicClient, signedAgentExecution) {
88
+ const calldata = await getAgentExecuteCalldata(signedAgentExecution);
89
+ const result = await publicClient.simulate({
90
+ blocks: [{
91
+ calls: [{
92
+ to: addresses_1.ROUTER_ADDRESS,
93
+ data: calldata,
94
+ }]
95
+ }]
96
+ });
97
+ return result;
98
+ }
66
99
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/entities/exchange/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,kCAMC;AAED,8BAUC;AAED,gDAIC;AA5BD,+BAAgE;AAChE,+DAAiD;AACjD,kDAA+C;AAExC,KAAK,UAAU,WAAW,CAAC,MAAW;IAC3C,MAAM,OAAO,GAAG,MAAM,2BAAY,CAAC,yBAAyB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/E,OAAO;QACL,GAAG,EAAE,IAAA,qBAAc,EAAC,EAAE,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACpE,MAAM,EAAE,IAAA,qBAAc,EAAC,EAAE,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;KACxE,CAAC;AACJ,CAAC;AAED,SAAgB,SAAS,CAAC,GAA+B;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,OAAO,IAAA,qBAAc,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS;QACX,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC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AAE,QAAQ;qBACf,CAAC;aACH,CAAC;KACH,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pendle/sdk-boros",
3
3
  "description": "Pendle SDK for Boros",
4
4
  "license": "MIT",
5
- "version": "0.1.36",
5
+ "version": "0.1.38",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "files": [