@pufferfinance/puffer-sdk 1.9.1 → 1.10.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.
Files changed (34) hide show
  1. package/dist/contracts/addresses.cjs +1 -1
  2. package/dist/contracts/addresses.cjs.map +1 -1
  3. package/dist/contracts/addresses.d.ts +26 -12
  4. package/dist/contracts/addresses.js +28 -11
  5. package/dist/contracts/addresses.js.map +1 -1
  6. package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
  7. package/dist/contracts/handlers/nucleus-accountant-handler.cjs.map +1 -1
  8. package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +10 -0
  9. package/dist/contracts/handlers/nucleus-accountant-handler.js +26 -11
  10. package/dist/contracts/handlers/nucleus-accountant-handler.js.map +1 -1
  11. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +1 -1
  12. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs.map +1 -1
  13. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +3 -3
  14. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -1
  15. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
  16. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
  17. package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +10 -6
  18. package/dist/contracts/handlers/nucleus-boring-vault-handler.js +38 -34
  19. package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
  20. package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
  21. package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
  22. package/dist/contracts/handlers/nucleus-teller-handler.d.ts +9 -0
  23. package/dist/contracts/handlers/nucleus-teller-handler.js +30 -19
  24. package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
  25. package/dist/contracts/tokens.cjs +1 -1
  26. package/dist/contracts/tokens.cjs.map +1 -1
  27. package/dist/contracts/tokens.d.ts +8 -2
  28. package/dist/contracts/tokens.js +39 -9
  29. package/dist/contracts/tokens.js.map +1 -1
  30. package/dist/main.cjs +1 -1
  31. package/dist/main.js +23 -22
  32. package/dist/utils/version.cjs +1 -1
  33. package/dist/utils/version.js +1 -1
  34. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../constants-DA2xUb9r.cjs"),a={[e.Chain.Mainnet]:{PufferVault:"0xD9A442856C234a39a81a089C06451EBAa4306a72",PufferDepositor:"0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",PufferL2Depositor:"0x3436E0B85cd929929F5802e792CFE282166E0259",PufLocker:"0x48e8dE138C246c14248C94d2D616a2F9eb4590D2",L1RewardManager:"0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b",L2RewardManager:"0x0000000000000000000000000000000000000000",PufferWithdrawalManager:"0xDdA0483184E75a5579ef9635ED14BacCf9d50283",NucleusBoringVault:"0x196ead472583bc1e9af7a05f860d9857e1bd3dcc",NucleusAccountant:"0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c",NucleusTeller:"0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53",AtomicQueue:"0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee"},[e.Chain.Holesky]:{PufferVault:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",PufferDepositor:"0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c",PufferL2Depositor:"0x0af6998e4828ad8ef8f79a9288d0a861890f791d",PufLocker:"0xa58983ad0899a452b7420bc57228e329d7ba92b6",L1RewardManager:"0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12",L2RewardManager:"0x58C046794f69A8830b0BE737022a45b4acd01dE5",PufferWithdrawalManager:"0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4",NucleusBoringVault:"0x0000000000000000000000000000000000000000",NucleusAccountant:"0x0000000000000000000000000000000000000000",NucleusTeller:"0x0000000000000000000000000000000000000000"},[e.Chain.Base]:{L2RewardManager:"0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7"}};exports.CONTRACT_ADDRESSES=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../constants-DA2xUb9r.cjs"),a=require("./tokens.cjs"),c={[e.Chain.Mainnet]:{PufferVault:"0xD9A442856C234a39a81a089C06451EBAa4306a72",PufferDepositor:"0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",PufferL2Depositor:"0x3436E0B85cd929929F5802e792CFE282166E0259",PufLocker:"0x48e8dE138C246c14248C94d2D616a2F9eb4590D2",L1RewardManager:"0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b",L2RewardManager:"0x0000000000000000000000000000000000000000",PufferWithdrawalManager:"0xDdA0483184E75a5579ef9635ED14BacCf9d50283",NucleusAtomicQueue:"0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee"},[e.Chain.Holesky]:{PufferVault:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",PufferDepositor:"0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c",PufferL2Depositor:"0x0af6998e4828ad8ef8f79a9288d0a861890f791d",PufLocker:"0xa58983ad0899a452b7420bc57228e329d7ba92b6",L1RewardManager:"0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12",L2RewardManager:"0x58C046794f69A8830b0BE737022a45b4acd01dE5",PufferWithdrawalManager:"0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4"},[e.Chain.Base]:{L2RewardManager:"0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7"}},f={[a.UnifiToken.unifiETH]:{[e.Chain.Mainnet]:{NucleusBoringVault:"0x196ead472583bc1e9af7a05f860d9857e1bd3dcc",NucleusAccountant:"0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c",NucleusTeller:"0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53"}},[a.UnifiToken.unifiUSD]:{[e.Chain.Mainnet]:{NucleusBoringVault:"0x82c40e07277eBb92935f79cE92268F80dDc7caB4",NucleusAccountant:"0xe0bDb7b9225A2CeB42998dc2E51D4D3CDeb7e3Be",NucleusTeller:"0x5d3Fb47FE7f3F4Ce8fe55518f7E4F7D6061B54DD"}},[a.UnifiToken.unifiBTC]:{[e.Chain.Mainnet]:{NucleusBoringVault:"0x170d847a8320f3b6a77ee15b0cae430e3ec933a0",NucleusAccountant:"0x2afb28b0561d99b5e00829ec2ef54946a00a35f7",NucleusTeller:"0x0743647a607822781f9d0a639454e76289182f0b"}}};exports.CONTRACT_ADDRESSES=c;exports.NUCLEUS_CONTRACT_ADDRESSES=f;
2
2
  //# sourceMappingURL=addresses.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.cjs","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L1RewardManager: '0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b',\n // L2RewardManager is not deployed to mainnet but base.\n L2RewardManager: '0x0000000000000000000000000000000000000000',\n PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',\n NucleusBoringVault: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n NucleusAccountant: '0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c',\n NucleusTeller: '0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53',\n AtomicQueue: '0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n // Nucleus contracts are not deployed to holesky.\n PufferWithdrawalManager: '0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4',\n NucleusBoringVault: '0x0000000000000000000000000000000000000000',\n NucleusAccountant: '0x0000000000000000000000000000000000000000',\n NucleusTeller: '0x0000000000000000000000000000000000000000',\n },\n [Chain.Base]: {\n L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":"6HAIaA,EAAqB,CAChC,CAACC,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CACX,gBAAiB,6CAEjB,gBAAiB,6CACjB,wBAAyB,6CACzB,mBAAoB,6CACpB,kBAAmB,6CACnB,cAAe,6CACf,YAAa,4CACf,EACA,CAACA,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CACX,gBAAiB,6CACjB,gBAAiB,6CAEjB,wBAAyB,6CACzB,mBAAoB,6CACpB,kBAAmB,6CACnB,cAAe,4CACjB,EACA,CAACA,EAAAA,MAAM,IAAI,EAAG,CACZ,gBAAiB,4CAAA,CAErB"}
1
+ {"version":3,"file":"addresses.cjs","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\nimport { UnifiToken } from './tokens';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L1RewardManager: '0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b',\n // L2RewardManager is not deployed to mainnet but base.\n L2RewardManager: '0x0000000000000000000000000000000000000000',\n PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',\n NucleusAtomicQueue: '0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n PufferWithdrawalManager: '0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4',\n },\n [Chain.Base]: {\n L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',\n },\n};\n\nexport const NUCLEUS_CONTRACT_ADDRESSES = {\n [UnifiToken.unifiETH]: {\n [Chain.Mainnet]: {\n NucleusBoringVault: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n NucleusAccountant: '0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c',\n NucleusTeller: '0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53',\n },\n },\n [UnifiToken.unifiUSD]: {\n [Chain.Mainnet]: {\n NucleusBoringVault: '0x82c40e07277eBb92935f79cE92268F80dDc7caB4',\n NucleusAccountant: '0xe0bDb7b9225A2CeB42998dc2E51D4D3CDeb7e3Be',\n NucleusTeller: '0x5d3Fb47FE7f3F4Ce8fe55518f7E4F7D6061B54DD',\n },\n },\n [UnifiToken.unifiBTC]: {\n [Chain.Mainnet]: {\n NucleusBoringVault: '0x170d847a8320f3b6a77ee15b0cae430e3ec933a0',\n NucleusAccountant: '0x2afb28b0561d99b5e00829ec2ef54946a00a35f7',\n NucleusTeller: '0x0743647a607822781f9d0a639454e76289182f0b',\n },\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain","NUCLEUS_CONTRACT_ADDRESSES","UnifiToken"],"mappings":"uJAKaA,EAAqB,CAChC,CAACC,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CACX,gBAAiB,6CAEjB,gBAAiB,6CACjB,wBAAyB,6CACzB,mBAAoB,4CACtB,EACA,CAACA,EAAAA,MAAM,OAAO,EAAG,CACf,YAAa,6CACb,gBAAiB,6CACjB,kBAAmB,6CACnB,UAAW,6CACX,gBAAiB,6CACjB,gBAAiB,6CACjB,wBAAyB,4CAC3B,EACA,CAACA,EAAAA,MAAM,IAAI,EAAG,CACZ,gBAAiB,4CAAA,CAErB,EAEaC,EAA6B,CACxC,CAACC,EAAAA,WAAW,QAAQ,EAAG,CACrB,CAACF,EAAAA,MAAM,OAAO,EAAG,CACf,mBAAoB,6CACpB,kBAAmB,6CACnB,cAAe,4CAAA,CAEnB,EACA,CAACE,EAAAA,WAAW,QAAQ,EAAG,CACrB,CAACF,EAAAA,MAAM,OAAO,EAAG,CACf,mBAAoB,6CACpB,kBAAmB,6CACnB,cAAe,4CAAA,CAEnB,EACA,CAACE,EAAAA,WAAW,QAAQ,EAAG,CACrB,CAACF,EAAAA,MAAM,OAAO,EAAG,CACf,mBAAoB,6CACpB,kBAAmB,6CACnB,cAAe,4CAAA,CACjB,CAEJ"}
@@ -7,10 +7,7 @@ export declare const CONTRACT_ADDRESSES: {
7
7
  L1RewardManager: string;
8
8
  L2RewardManager: string;
9
9
  PufferWithdrawalManager: string;
10
- NucleusBoringVault: string;
11
- NucleusAccountant: string;
12
- NucleusTeller: string;
13
- AtomicQueue: string;
10
+ NucleusAtomicQueue: string;
14
11
  } | {
15
12
  PufferVault: string;
16
13
  PufferDepositor: string;
@@ -19,10 +16,7 @@ export declare const CONTRACT_ADDRESSES: {
19
16
  L1RewardManager: string;
20
17
  L2RewardManager: string;
21
18
  PufferWithdrawalManager: string;
22
- NucleusBoringVault: string;
23
- NucleusAccountant: string;
24
- NucleusTeller: string;
25
- AtomicQueue?: undefined;
19
+ NucleusAtomicQueue?: undefined;
26
20
  } | {
27
21
  L2RewardManager: string;
28
22
  PufferVault?: undefined;
@@ -31,9 +25,29 @@ export declare const CONTRACT_ADDRESSES: {
31
25
  PufLocker?: undefined;
32
26
  L1RewardManager?: undefined;
33
27
  PufferWithdrawalManager?: undefined;
34
- NucleusBoringVault?: undefined;
35
- NucleusAccountant?: undefined;
36
- NucleusTeller?: undefined;
37
- AtomicQueue?: undefined;
28
+ NucleusAtomicQueue?: undefined;
29
+ };
30
+ };
31
+ export declare const NUCLEUS_CONTRACT_ADDRESSES: {
32
+ unifiETH: {
33
+ [x: number]: {
34
+ NucleusBoringVault: string;
35
+ NucleusAccountant: string;
36
+ NucleusTeller: string;
37
+ };
38
+ };
39
+ unifiUSD: {
40
+ [x: number]: {
41
+ NucleusBoringVault: string;
42
+ NucleusAccountant: string;
43
+ NucleusTeller: string;
44
+ };
45
+ };
46
+ unifiBTC: {
47
+ [x: number]: {
48
+ NucleusBoringVault: string;
49
+ NucleusAccountant: string;
50
+ NucleusTeller: string;
51
+ };
38
52
  };
39
53
  };
@@ -1,5 +1,6 @@
1
1
  import { C as e } from "../constants-BjRNQpT2.js";
2
- const c = {
2
+ import { UnifiToken as a } from "./tokens.js";
3
+ const d = {
3
4
  [e.Mainnet]: {
4
5
  PufferVault: "0xD9A442856C234a39a81a089C06451EBAa4306a72",
5
6
  PufferDepositor: "0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",
@@ -9,10 +10,7 @@ const c = {
9
10
  // L2RewardManager is not deployed to mainnet but base.
10
11
  L2RewardManager: "0x0000000000000000000000000000000000000000",
11
12
  PufferWithdrawalManager: "0xDdA0483184E75a5579ef9635ED14BacCf9d50283",
12
- NucleusBoringVault: "0x196ead472583bc1e9af7a05f860d9857e1bd3dcc",
13
- NucleusAccountant: "0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c",
14
- NucleusTeller: "0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53",
15
- AtomicQueue: "0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee"
13
+ NucleusAtomicQueue: "0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee"
16
14
  },
17
15
  [e.Holesky]: {
18
16
  PufferVault: "0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",
@@ -21,17 +19,36 @@ const c = {
21
19
  PufLocker: "0xa58983ad0899a452b7420bc57228e329d7ba92b6",
22
20
  L1RewardManager: "0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12",
23
21
  L2RewardManager: "0x58C046794f69A8830b0BE737022a45b4acd01dE5",
24
- // Nucleus contracts are not deployed to holesky.
25
- PufferWithdrawalManager: "0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4",
26
- NucleusBoringVault: "0x0000000000000000000000000000000000000000",
27
- NucleusAccountant: "0x0000000000000000000000000000000000000000",
28
- NucleusTeller: "0x0000000000000000000000000000000000000000"
22
+ PufferWithdrawalManager: "0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4"
29
23
  },
30
24
  [e.Base]: {
31
25
  L2RewardManager: "0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7"
32
26
  }
27
+ }, b = {
28
+ [a.unifiETH]: {
29
+ [e.Mainnet]: {
30
+ NucleusBoringVault: "0x196ead472583bc1e9af7a05f860d9857e1bd3dcc",
31
+ NucleusAccountant: "0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c",
32
+ NucleusTeller: "0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53"
33
+ }
34
+ },
35
+ [a.unifiUSD]: {
36
+ [e.Mainnet]: {
37
+ NucleusBoringVault: "0x82c40e07277eBb92935f79cE92268F80dDc7caB4",
38
+ NucleusAccountant: "0xe0bDb7b9225A2CeB42998dc2E51D4D3CDeb7e3Be",
39
+ NucleusTeller: "0x5d3Fb47FE7f3F4Ce8fe55518f7E4F7D6061B54DD"
40
+ }
41
+ },
42
+ [a.unifiBTC]: {
43
+ [e.Mainnet]: {
44
+ NucleusBoringVault: "0x170d847a8320f3b6a77ee15b0cae430e3ec933a0",
45
+ NucleusAccountant: "0x2afb28b0561d99b5e00829ec2ef54946a00a35f7",
46
+ NucleusTeller: "0x0743647a607822781f9d0a639454e76289182f0b"
47
+ }
48
+ }
33
49
  };
34
50
  export {
35
- c as CONTRACT_ADDRESSES
51
+ d as CONTRACT_ADDRESSES,
52
+ b as NUCLEUS_CONTRACT_ADDRESSES
36
53
  };
37
54
  //# sourceMappingURL=addresses.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.js","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L1RewardManager: '0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b',\n // L2RewardManager is not deployed to mainnet but base.\n L2RewardManager: '0x0000000000000000000000000000000000000000',\n PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',\n NucleusBoringVault: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n NucleusAccountant: '0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c',\n NucleusTeller: '0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53',\n AtomicQueue: '0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n // Nucleus contracts are not deployed to holesky.\n PufferWithdrawalManager: '0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4',\n NucleusBoringVault: '0x0000000000000000000000000000000000000000',\n NucleusAccountant: '0x0000000000000000000000000000000000000000',\n NucleusTeller: '0x0000000000000000000000000000000000000000',\n },\n [Chain.Base]: {\n L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain"],"mappings":";AAIO,MAAMA,IAAqB;AAAA,EAChC,CAACC,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA;AAAA,IAEjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,aAAa;AAAA,EACf;AAAA,EACA,CAACA,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA;AAAA,IAEjB,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,eAAe;AAAA,EACjB;AAAA,EACA,CAACA,EAAM,IAAI,GAAG;AAAA,IACZ,iBAAiB;AAAA,EAAA;AAErB;"}
1
+ {"version":3,"file":"addresses.js","sources":["../../lib/contracts/addresses.ts"],"sourcesContent":["import { Chain } from '../chains/constants';\nimport { UnifiToken } from './tokens';\n\n// Source of truth:\n// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments\nexport const CONTRACT_ADDRESSES = {\n [Chain.Mainnet]: {\n PufferVault: '0xD9A442856C234a39a81a089C06451EBAa4306a72',\n PufferDepositor: '0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff',\n PufferL2Depositor: '0x3436E0B85cd929929F5802e792CFE282166E0259',\n PufLocker: '0x48e8dE138C246c14248C94d2D616a2F9eb4590D2',\n L1RewardManager: '0x157788cc028Ac6405bD406f2D1e0A8A22b3cf17b',\n // L2RewardManager is not deployed to mainnet but base.\n L2RewardManager: '0x0000000000000000000000000000000000000000',\n PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',\n NucleusAtomicQueue: '0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee',\n },\n [Chain.Holesky]: {\n PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',\n PufferDepositor: '0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c',\n PufferL2Depositor: '0x0af6998e4828ad8ef8f79a9288d0a861890f791d',\n PufLocker: '0xa58983ad0899a452b7420bc57228e329d7ba92b6',\n L1RewardManager: '0x10f970bcb84B82B82a65eBCbF45F26dD26D69F12',\n L2RewardManager: '0x58C046794f69A8830b0BE737022a45b4acd01dE5',\n PufferWithdrawalManager: '0x5A3E1069B66800c0ecbc91bd81b1AE4D1804DBc4',\n },\n [Chain.Base]: {\n L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',\n },\n};\n\nexport const NUCLEUS_CONTRACT_ADDRESSES = {\n [UnifiToken.unifiETH]: {\n [Chain.Mainnet]: {\n NucleusBoringVault: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',\n NucleusAccountant: '0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c',\n NucleusTeller: '0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53',\n },\n },\n [UnifiToken.unifiUSD]: {\n [Chain.Mainnet]: {\n NucleusBoringVault: '0x82c40e07277eBb92935f79cE92268F80dDc7caB4',\n NucleusAccountant: '0xe0bDb7b9225A2CeB42998dc2E51D4D3CDeb7e3Be',\n NucleusTeller: '0x5d3Fb47FE7f3F4Ce8fe55518f7E4F7D6061B54DD',\n },\n },\n [UnifiToken.unifiBTC]: {\n [Chain.Mainnet]: {\n NucleusBoringVault: '0x170d847a8320f3b6a77ee15b0cae430e3ec933a0',\n NucleusAccountant: '0x2afb28b0561d99b5e00829ec2ef54946a00a35f7',\n NucleusTeller: '0x0743647a607822781f9d0a639454e76289182f0b',\n },\n },\n};\n"],"names":["CONTRACT_ADDRESSES","Chain","NUCLEUS_CONTRACT_ADDRESSES","UnifiToken"],"mappings":";;AAKO,MAAMA,IAAqB;AAAA,EAChC,CAACC,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA;AAAA,IAEjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,EACtB;AAAA,EACA,CAACA,EAAM,OAAO,GAAG;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,EAC3B;AAAA,EACA,CAACA,EAAM,IAAI,GAAG;AAAA,IACZ,iBAAiB;AAAA,EAAA;AAErB,GAEaC,IAA6B;AAAA,EACxC,CAACC,EAAW,QAAQ,GAAG;AAAA,IACrB,CAACF,EAAM,OAAO,GAAG;AAAA,MACf,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,MACnB,eAAe;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA,CAACE,EAAW,QAAQ,GAAG;AAAA,IACrB,CAACF,EAAM,OAAO,GAAG;AAAA,MACf,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,MACnB,eAAe;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA,CAACE,EAAW,QAAQ,GAAG;AAAA,IACrB,CAACF,EAAM,OAAO,GAAG;AAAA,MACf,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,MACnB,eAAe;AAAA,IAAA;AAAA,EACjB;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../addresses.cjs"),n=require("../abis/nucleus-accountant-abis.cjs"),c=require("../../getContract-3QbyfZBF.cjs");class s{constructor(t,e,a){this.chain=t,this.walletClient=e,this.publicClient=a}getContract(){const t=r.CONTRACT_ADDRESSES[this.chain].NucleusAccountant,e=n.NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant,a={public:this.publicClient,wallet:this.walletClient};return c.getContract({address:t,abi:e,client:a})}async rateProviderData(t){const[e,a]=await this.getContract().read.rateProviderData([t]);return{isPeggedToBase:e,rateProvider:a}}vault(){return this.getContract().read.vault()}getRate(){return this.getContract().read.getRate()}getRateSafe(){return this.getContract().read.getRateSafe()}getRateInQuote(t){return this.getContract().read.getRateInQuote([t])}getRateInQuoteSafe(t){return this.getContract().read.getRateInQuoteSafe([t])}}exports.NucleusAccountantHandler=s;
1
+ "use strict";var c=Object.defineProperty;var i=(n,t,e)=>t in n?c(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var r=(n,t,e)=>i(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../addresses.cjs"),o=require("../abis/nucleus-accountant-abis.cjs"),u=require("../tokens.cjs"),l=require("../../getContract-3QbyfZBF.cjs");class g{constructor(t,e,a){r(this,"token");this.chain=t,this.walletClient=e,this.publicClient=a,this.token=u.UnifiToken.unifiETH}withToken(t){return this.token=t,this}getContract(){const t=s.NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain].NucleusAccountant,e=o.NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant,a={public:this.publicClient,wallet:this.walletClient};return l.getContract({address:t,abi:e,client:a})}async rateProviderData(t){const[e,a]=await this.getContract().read.rateProviderData([t]);return{isPeggedToBase:e,rateProvider:a}}vault(){return this.getContract().read.vault()}getRate(){return this.getContract().read.getRate()}getRateSafe(){return this.getContract().read.getRateSafe()}getRateInQuote(t){return this.getContract().read.getRateInQuote([t])}getRateInQuoteSafe(t){return this.getContract().read.getRateInQuoteSafe([t])}}exports.NucleusAccountantHandler=g;
2
2
  //# sourceMappingURL=nucleus-accountant-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-accountant-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {}\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusAccountant as Address;\n const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","address","CONTRACT_ADDRESSES","abi","NUCLEUS_ACCOUNTANT_ABIS","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":"iNAgBO,MAAMA,CAAyB,CAUpC,YACUC,EACAC,EACAC,EACR,CAHQ,KAAA,MAAAF,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,CAAA,CASH,aAAc,CACnB,MAAMC,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,kBACzCC,EAAMC,EAAA,wBAAwB,KAAK,KAAK,EAAE,WAC1CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAa7C,MAAa,iBAAiBE,EAAuB,CACnD,KAAM,CAACC,EAAgBC,CAAY,EACjC,MAAM,KAAK,YAAY,EAAE,KAAK,iBAAiB,CAACF,CAAY,CAAC,EAExD,MAAA,CAAE,eAAAC,EAAgB,aAAAC,CAAa,CAAA,CAQjC,OAAQ,CACb,OAAO,KAAK,cAAc,KAAK,MAAM,CAAA,CAQhC,SAAU,CACf,OAAO,KAAK,cAAc,KAAK,QAAQ,CAAA,CAQlC,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAQtC,eAAeC,EAAuB,CAC3C,OAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAY,CAAC,CAAA,CAQvD,mBAAmBA,EAAuB,CAC/C,OAAO,KAAK,YAAY,EAAE,KAAK,mBAAmB,CAACA,CAAY,CAAC,CAAA,CAEpE"}
1
+ {"version":3,"file":"nucleus-accountant-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';\nimport { UnifiToken } from '../tokens';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain]\n .NucleusAccountant as Address;\n const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","__publicField","UnifiToken","token","address","NUCLEUS_CONTRACT_ADDRESSES","abi","NUCLEUS_ACCOUNTANT_ABIS","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":"gZAiBO,MAAMA,CAAyB,CAYpC,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAER,KAAK,MAAQE,EAAAA,WAAW,QAAA,CAUnB,UAAUC,EAAmB,CAClC,YAAK,MAAQA,EACN,IAAA,CASF,aAAc,CACnB,MAAMC,EAAUC,EAAAA,2BAA2B,KAAK,KAAK,EAAE,KAAK,KAAK,EAC9D,kBACGC,EAAMC,EAAA,wBAAwB,KAAK,KAAK,EAAE,WAC1CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAa7C,MAAa,iBAAiBE,EAAuB,CACnD,KAAM,CAACC,EAAgBC,CAAY,EACjC,MAAM,KAAK,YAAY,EAAE,KAAK,iBAAiB,CAACF,CAAY,CAAC,EAExD,MAAA,CAAE,eAAAC,EAAgB,aAAAC,CAAa,CAAA,CAQjC,OAAQ,CACb,OAAO,KAAK,cAAc,KAAK,MAAM,CAAA,CAQhC,SAAU,CACf,OAAO,KAAK,cAAc,KAAK,QAAQ,CAAA,CAQlC,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAQtC,eAAeC,EAAuB,CAC3C,OAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAY,CAAC,CAAA,CAQvD,mBAAmBA,EAAuB,CAC/C,OAAO,KAAK,YAAY,EAAE,KAAK,mBAAmB,CAACA,CAAY,CAAC,CAAA,CAEpE"}
@@ -1,5 +1,6 @@
1
1
  import { WalletClient, PublicClient, Address, GetContractReturnType } from 'viem';
2
2
  import { Chain } from '../../chains/constants';
3
+ import { UnifiToken } from '../tokens';
3
4
  /**
4
5
  * Handler for the `Accountant` contract from nucleus.
5
6
  */
@@ -7,6 +8,7 @@ export declare class NucleusAccountantHandler {
7
8
  private chain;
8
9
  private walletClient;
9
10
  private publicClient;
11
+ private token;
10
12
  /**
11
13
  * Create the handler for processing tokens.
12
14
  *
@@ -17,6 +19,14 @@ export declare class NucleusAccountantHandler {
17
19
  * interactions.
18
20
  */
19
21
  constructor(chain: Chain, walletClient: WalletClient, publicClient: PublicClient);
22
+ /**
23
+ * Set the UniFi token to use for executing transactions on the
24
+ * contract.
25
+ *
26
+ * @param token UniFi token to use for the handler.
27
+ * @returns The handler.
28
+ */
29
+ withToken(token: UnifiToken): this;
20
30
  /**
21
31
  * Get the contract. This is a method because the typings are complex
22
32
  * and lost when trying to make it a member.
@@ -1,7 +1,11 @@
1
- import { CONTRACT_ADDRESSES as r } from "../addresses.js";
2
- import { NUCLEUS_ACCOUNTANT_ABIS as n } from "../abis/nucleus-accountant-abis.js";
3
- import { g as i } from "../../getContract-CezEyDf-.js";
4
- class l {
1
+ var i = Object.defineProperty;
2
+ var o = (a, t, e) => t in a ? i(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var n = (a, t, e) => o(a, typeof t != "symbol" ? t + "" : t, e);
4
+ import { NUCLEUS_CONTRACT_ADDRESSES as s } from "../addresses.js";
5
+ import { NUCLEUS_ACCOUNTANT_ABIS as c } from "../abis/nucleus-accountant-abis.js";
6
+ import { UnifiToken as u } from "../tokens.js";
7
+ import { g as h } from "../../getContract-CezEyDf-.js";
8
+ class R {
5
9
  /**
6
10
  * Create the handler for processing tokens.
7
11
  *
@@ -11,8 +15,19 @@ class l {
11
15
  * @param publicClient The public client to use for public
12
16
  * interactions.
13
17
  */
14
- constructor(t, e, a) {
15
- this.chain = t, this.walletClient = e, this.publicClient = a;
18
+ constructor(t, e, r) {
19
+ n(this, "token");
20
+ this.chain = t, this.walletClient = e, this.publicClient = r, this.token = u.unifiETH;
21
+ }
22
+ /**
23
+ * Set the UniFi token to use for executing transactions on the
24
+ * contract.
25
+ *
26
+ * @param token UniFi token to use for the handler.
27
+ * @returns The handler.
28
+ */
29
+ withToken(t) {
30
+ return this.token = t, this;
16
31
  }
17
32
  /**
18
33
  * Get the contract. This is a method because the typings are complex
@@ -21,8 +36,8 @@ class l {
21
36
  * @returns The viem contract.
22
37
  */
23
38
  getContract() {
24
- const t = r[this.chain].NucleusAccountant, e = n[this.chain].Accountant, a = { public: this.publicClient, wallet: this.walletClient };
25
- return i({ address: t, abi: e, client: a });
39
+ const t = s[this.token][this.chain].NucleusAccountant, e = c[this.chain].Accountant, r = { public: this.publicClient, wallet: this.walletClient };
40
+ return h({ address: t, abi: e, client: r });
26
41
  }
27
42
  /**
28
43
  * Get the rate provider data for the given token address.
@@ -31,8 +46,8 @@ class l {
31
46
  * @returns Rate provider data for the given token address.
32
47
  */
33
48
  async rateProviderData(t) {
34
- const [e, a] = await this.getContract().read.rateProviderData([t]);
35
- return { isPeggedToBase: e, rateProvider: a };
49
+ const [e, r] = await this.getContract().read.rateProviderData([t]);
50
+ return { isPeggedToBase: e, rateProvider: r };
36
51
  }
37
52
  /**
38
53
  * Get the vault for the given token address.
@@ -76,6 +91,6 @@ class l {
76
91
  }
77
92
  }
78
93
  export {
79
- l as NucleusAccountantHandler
94
+ R as NucleusAccountantHandler
80
95
  };
81
96
  //# sourceMappingURL=nucleus-accountant-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-accountant-handler.js","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {}\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].NucleusAccountant as Address;\n const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","address","CONTRACT_ADDRESSES","abi","NUCLEUS_ACCOUNTANT_ABIS","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":";;;AAgBO,MAAMA,EAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUpC,YACUC,GACAC,GACAC,GACR;AAHQ,SAAA,QAAAF,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASH,cAAc;AACnB,UAAMC,IAAUC,EAAmB,KAAK,KAAK,EAAE,mBACzCC,IAAMC,EAAwB,KAAK,KAAK,EAAE,YAC1CC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa7C,MAAa,iBAAiBE,GAAuB;AACnD,UAAM,CAACC,GAAgBC,CAAY,IACjC,MAAM,KAAK,YAAY,EAAE,KAAK,iBAAiB,CAACF,CAAY,CAAC;AAExD,WAAA,EAAE,gBAAAC,GAAgB,cAAAC,EAAa;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjC,QAAQ;AACb,WAAO,KAAK,cAAc,KAAK,MAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhC,UAAU;AACf,WAAO,KAAK,cAAc,KAAK,QAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlC,cAAc;AACnB,WAAO,KAAK,cAAc,KAAK,YAAY;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQtC,eAAeC,GAAuB;AAC3C,WAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAY,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,mBAAmBA,GAAuB;AAC/C,WAAO,KAAK,YAAY,EAAE,KAAK,mBAAmB,CAACA,CAAY,CAAC;AAAA,EAAA;AAEpE;"}
1
+ {"version":3,"file":"nucleus-accountant-handler.js","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';\nimport { UnifiToken } from '../tokens';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain]\n .NucleusAccountant as Address;\n const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","__publicField","UnifiToken","token","address","NUCLEUS_CONTRACT_ADDRESSES","abi","NUCLEUS_ACCOUNTANT_ABIS","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":";;;;;;;AAiBO,MAAMA,EAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYpC,YACUC,GACAC,GACAC,GACR;AAfM,IAAAC,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAER,KAAK,QAAQE,EAAW;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnB,UAAUC,GAAmB;AAClC,gBAAK,QAAQA,GACN;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASF,cAAc;AACnB,UAAMC,IAAUC,EAA2B,KAAK,KAAK,EAAE,KAAK,KAAK,EAC9D,mBACGC,IAAMC,EAAwB,KAAK,KAAK,EAAE,YAC1CC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa7C,MAAa,iBAAiBE,GAAuB;AACnD,UAAM,CAACC,GAAgBC,CAAY,IACjC,MAAM,KAAK,YAAY,EAAE,KAAK,iBAAiB,CAACF,CAAY,CAAC;AAExD,WAAA,EAAE,gBAAAC,GAAgB,cAAAC,EAAa;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjC,QAAQ;AACb,WAAO,KAAK,cAAc,KAAK,MAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhC,UAAU;AACf,WAAO,KAAK,cAAc,KAAK,QAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlC,cAAc;AACnB,WAAO,KAAK,cAAc,KAAK,YAAY;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQtC,eAAeC,GAAuB;AAC3C,WAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAY,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,mBAAmBA,GAAuB;AAC/C,WAAO,KAAK,YAAY,EAAE,KAAK,mBAAmB,CAACA,CAAY,CAAC;AAAA,EAAA;AAEpE;"}
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var a=(s,t,e)=>t in s?u(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var n=(s,t,e)=>a(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants-DA2xUb9r.cjs"),l=require("../addresses.cjs"),h=require("../abis/nucleus-atomic-queue-abis.cjs"),C=require("../../getContract-3QbyfZBF.cjs");class A{constructor(t,e,i){n(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=o.VIEM_CHAINS[t]}getContract(){const t=l.CONTRACT_ADDRESSES[this.chain].AtomicQueue,e=h.NUCLEUS_ATOMIC_QUEUE_ABIS[this.chain].AtomicQueue,i={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:t,abi:e,client:i})}getUserAtomicRequest(t,e,i){return this.getContract().read.getUserAtomicRequest([t,e,i])}isAtomicRequestValid(t,e,i){return this.getContract().read.isAtomicRequestValid([t,e,i])}solve(t,e,i,c,r){return this.getContract().write.solve([t,e,i,c,r],{account:this.walletClient.account,chain:this.viemChain})}updateAtomicRequest(t,e,i,c){return this.getContract().write.updateAtomicRequest([t,e,i],{account:c,chain:this.viemChain})}userAtomicRequest(t,e,i){return this.getContract().read.userAtomicRequest([t,e,i])}}exports.NucleusAtomicQueueHandler=A;
1
+ "use strict";var r=Object.defineProperty;var a=(s,t,e)=>t in s?r(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var u=(s,t,e)=>a(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants-DA2xUb9r.cjs"),l=require("../addresses.cjs"),h=require("../abis/nucleus-atomic-queue-abis.cjs"),C=require("../../getContract-3QbyfZBF.cjs");class A{constructor(t,e,i){u(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=o.VIEM_CHAINS[t]}getContract(){const t=l.CONTRACT_ADDRESSES[this.chain].NucleusAtomicQueue,e=h.NUCLEUS_ATOMIC_QUEUE_ABIS[this.chain].AtomicQueue,i={public:this.publicClient,wallet:this.walletClient};return C.getContract({address:t,abi:e,client:i})}getUserAtomicRequest(t,e,i){return this.getContract().read.getUserAtomicRequest([t,e,i])}isAtomicRequestValid(t,e,i){return this.getContract().read.isAtomicRequestValid([t,e,i])}solve(t,e,i,c,n){return this.getContract().write.solve([t,e,i,c,n],{account:this.walletClient.account,chain:this.viemChain})}updateAtomicRequest(t,e,i,c){return this.getContract().write.updateAtomicRequest([t,e,i],{account:c,chain:this.viemChain})}userAtomicRequest(t,e,i){return this.getContract().read.userAtomicRequest([t,e,i])}}exports.NucleusAtomicQueueHandler=A;
2
2
  //# sourceMappingURL=nucleus-atomic-queue-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-atomic-queue-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-atomic-queue-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain } from 'viem';\nimport { Chain as LocalChain, VIEM_CHAINS } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ATOMIC_QUEUE_ABIS } from '../abis/nucleus-atomic-queue-abis';\n\nexport type AtomicRequest = {\n deadline: bigint;\n atomicPrice: bigint;\n offerAmount: bigint;\n inSolve: boolean;\n};\n\nexport type SolveMetaData = {\n user: Address;\n flags: number;\n assetsToOffer: bigint;\n assetsForWant: bigint;\n};\n\n/**\n * Handler for the `AtomicQueue` contract.\n */\nexport class NucleusAtomicQueueHandler {\n private viemChain: Chain;\n\n constructor(\n private chain: LocalChain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].AtomicQueue as Address;\n const abi = NUCLEUS_ATOMIC_QUEUE_ABIS[this.chain].AtomicQueue;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the atomic request details for a specific user (wallet address).\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public getUserAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.getUserAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n\n /**\n * Check if an atomic request is valid.\n * @param offerToken Token being offered\n * @param user User address\n * @param request Atomic request details\n */\n public isAtomicRequestValid(\n offerToken: Address,\n user: Address,\n request: AtomicRequest,\n ) {\n return this.getContract().read.isAtomicRequestValid([\n offerToken,\n user,\n request,\n ]);\n }\n\n /**\n * Solve atomic requests for multiple users.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param users Array of user addresses\n * @param runData Execution data for the solve\n * @param solver Address of the solver\n */\n public solve(\n offerToken: Address,\n wantToken: Address,\n users: Address[],\n runData: `0x${string}`,\n solver: Address,\n ) {\n return this.getContract().write.solve(\n [offerToken, wantToken, users, runData, solver],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Update an atomic request.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param request New atomic request details\n */\n public updateAtomicRequest(\n offerToken: Address,\n wantToken: Address,\n request: AtomicRequest,\n ownerAddress: Address,\n ) {\n return this.getContract().write.updateAtomicRequest(\n [offerToken, wantToken, request],\n { account: ownerAddress, chain: this.viemChain },\n );\n }\n\n /**\n * Get user's atomic request details directly from storage.\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public userAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.userAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n}\n"],"names":["NucleusAtomicQueueHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_ATOMIC_QUEUE_ABIS","client","getContract","user","offerToken","wantToken","request","users","runData","solver","ownerAddress"],"mappings":"iaA8BO,MAAMA,CAA0B,CAGrC,YACUC,EACAC,EACAC,EACR,CANMC,EAAA,kBAGE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAG7B,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAAE,YACzCC,EAAMC,EAAA,0BAA0B,KAAK,KAAK,EAAE,YAC5CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAatC,qBACLE,EACAC,EACAC,EACA,CACA,OAAO,KAAK,cAAc,KAAK,qBAAqB,CAClDF,EACAC,EACAC,CAAA,CACD,CAAA,CASI,qBACLD,EACAD,EACAG,EACA,CACA,OAAO,KAAK,cAAc,KAAK,qBAAqB,CAClDF,EACAD,EACAG,CAAA,CACD,CAAA,CAWI,MACLF,EACAC,EACAE,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,MAC9B,CAACL,EAAYC,EAAWE,EAAOC,EAASC,CAAM,EAC9C,CACE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CAEhB,CAAA,CASK,oBACLL,EACAC,EACAC,EACAI,EACA,CACO,OAAA,KAAK,cAAc,MAAM,oBAC9B,CAACN,EAAYC,EAAWC,CAAO,EAC/B,CAAE,QAASI,EAAc,MAAO,KAAK,SAAU,CACjD,CAAA,CASK,kBACLP,EACAC,EACAC,EACA,CACA,OAAO,KAAK,cAAc,KAAK,kBAAkB,CAC/CF,EACAC,EACAC,CAAA,CACD,CAAA,CAEL"}
1
+ {"version":3,"file":"nucleus-atomic-queue-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-atomic-queue-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain } from 'viem';\nimport { Chain as LocalChain, VIEM_CHAINS } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ATOMIC_QUEUE_ABIS } from '../abis/nucleus-atomic-queue-abis';\n\nexport type AtomicRequest = {\n deadline: bigint;\n atomicPrice: bigint;\n offerAmount: bigint;\n inSolve: boolean;\n};\n\nexport type SolveMetaData = {\n user: Address;\n flags: number;\n assetsToOffer: bigint;\n assetsForWant: bigint;\n};\n\n/**\n * Handler for the `AtomicQueue` contract.\n */\nexport class NucleusAtomicQueueHandler {\n private viemChain: Chain;\n\n constructor(\n private chain: LocalChain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusAtomicQueue as Address;\n const abi = NUCLEUS_ATOMIC_QUEUE_ABIS[this.chain].AtomicQueue;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the atomic request details for a specific user (wallet address).\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public getUserAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.getUserAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n\n /**\n * Check if an atomic request is valid.\n * @param offerToken Token being offered\n * @param user User address\n * @param request Atomic request details\n */\n public isAtomicRequestValid(\n offerToken: Address,\n user: Address,\n request: AtomicRequest,\n ) {\n return this.getContract().read.isAtomicRequestValid([\n offerToken,\n user,\n request,\n ]);\n }\n\n /**\n * Solve atomic requests for multiple users.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param users Array of user addresses\n * @param runData Execution data for the solve\n * @param solver Address of the solver\n */\n public solve(\n offerToken: Address,\n wantToken: Address,\n users: Address[],\n runData: `0x${string}`,\n solver: Address,\n ) {\n return this.getContract().write.solve(\n [offerToken, wantToken, users, runData, solver],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Update an atomic request.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param request New atomic request details\n */\n public updateAtomicRequest(\n offerToken: Address,\n wantToken: Address,\n request: AtomicRequest,\n ownerAddress: Address,\n ) {\n return this.getContract().write.updateAtomicRequest(\n [offerToken, wantToken, request],\n { account: ownerAddress, chain: this.viemChain },\n );\n }\n\n /**\n * Get user's atomic request details directly from storage.\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public userAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.userAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n}\n"],"names":["NucleusAtomicQueueHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_ATOMIC_QUEUE_ABIS","client","getContract","user","offerToken","wantToken","request","users","runData","solver","ownerAddress"],"mappings":"iaA8BO,MAAMA,CAA0B,CAGrC,YACUC,EACAC,EACAC,EACR,CANMC,EAAA,kBAGE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAG7B,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAC1C,mBACGC,EAAMC,EAAA,0BAA0B,KAAK,KAAK,EAAE,YAC5CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAatC,qBACLE,EACAC,EACAC,EACA,CACA,OAAO,KAAK,cAAc,KAAK,qBAAqB,CAClDF,EACAC,EACAC,CAAA,CACD,CAAA,CASI,qBACLD,EACAD,EACAG,EACA,CACA,OAAO,KAAK,cAAc,KAAK,qBAAqB,CAClDF,EACAD,EACAG,CAAA,CACD,CAAA,CAWI,MACLF,EACAC,EACAE,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,MAC9B,CAACL,EAAYC,EAAWE,EAAOC,EAASC,CAAM,EAC9C,CACE,QAAS,KAAK,aAAa,QAC3B,MAAO,KAAK,SAAA,CAEhB,CAAA,CASK,oBACLL,EACAC,EACAC,EACAI,EACA,CACO,OAAA,KAAK,cAAc,MAAM,oBAC9B,CAACN,EAAYC,EAAWC,CAAO,EAC/B,CAAE,QAASI,EAAc,MAAO,KAAK,SAAU,CACjD,CAAA,CASK,kBACLP,EACAC,EACAC,EACA,CACA,OAAO,KAAK,cAAc,KAAK,kBAAkB,CAC/CF,EACAC,EACAC,CAAA,CACD,CAAA,CAEL"}
@@ -2,8 +2,8 @@ var a = Object.defineProperty;
2
2
  var n = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
3
  var c = (s, t, e) => n(s, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { V as u } from "../../constants-BjRNQpT2.js";
5
- import { CONTRACT_ADDRESSES as h } from "../addresses.js";
6
- import { NUCLEUS_ATOMIC_QUEUE_ABIS as l } from "../abis/nucleus-atomic-queue-abis.js";
5
+ import { CONTRACT_ADDRESSES as l } from "../addresses.js";
6
+ import { NUCLEUS_ATOMIC_QUEUE_ABIS as h } from "../abis/nucleus-atomic-queue-abis.js";
7
7
  import { g as m } from "../../getContract-CezEyDf-.js";
8
8
  class R {
9
9
  constructor(t, e, i) {
@@ -11,7 +11,7 @@ class R {
11
11
  this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = u[t];
12
12
  }
13
13
  getContract() {
14
- const t = h[this.chain].AtomicQueue, e = l[this.chain].AtomicQueue, i = { public: this.publicClient, wallet: this.walletClient };
14
+ const t = l[this.chain].NucleusAtomicQueue, e = h[this.chain].AtomicQueue, i = { public: this.publicClient, wallet: this.walletClient };
15
15
  return m({ address: t, abi: e, client: i });
16
16
  }
17
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-atomic-queue-handler.js","sources":["../../../lib/contracts/handlers/nucleus-atomic-queue-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain } from 'viem';\nimport { Chain as LocalChain, VIEM_CHAINS } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ATOMIC_QUEUE_ABIS } from '../abis/nucleus-atomic-queue-abis';\n\nexport type AtomicRequest = {\n deadline: bigint;\n atomicPrice: bigint;\n offerAmount: bigint;\n inSolve: boolean;\n};\n\nexport type SolveMetaData = {\n user: Address;\n flags: number;\n assetsToOffer: bigint;\n assetsForWant: bigint;\n};\n\n/**\n * Handler for the `AtomicQueue` contract.\n */\nexport class NucleusAtomicQueueHandler {\n private viemChain: Chain;\n\n constructor(\n private chain: LocalChain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].AtomicQueue as Address;\n const abi = NUCLEUS_ATOMIC_QUEUE_ABIS[this.chain].AtomicQueue;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the atomic request details for a specific user (wallet address).\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public getUserAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.getUserAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n\n /**\n * Check if an atomic request is valid.\n * @param offerToken Token being offered\n * @param user User address\n * @param request Atomic request details\n */\n public isAtomicRequestValid(\n offerToken: Address,\n user: Address,\n request: AtomicRequest,\n ) {\n return this.getContract().read.isAtomicRequestValid([\n offerToken,\n user,\n request,\n ]);\n }\n\n /**\n * Solve atomic requests for multiple users.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param users Array of user addresses\n * @param runData Execution data for the solve\n * @param solver Address of the solver\n */\n public solve(\n offerToken: Address,\n wantToken: Address,\n users: Address[],\n runData: `0x${string}`,\n solver: Address,\n ) {\n return this.getContract().write.solve(\n [offerToken, wantToken, users, runData, solver],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Update an atomic request.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param request New atomic request details\n */\n public updateAtomicRequest(\n offerToken: Address,\n wantToken: Address,\n request: AtomicRequest,\n ownerAddress: Address,\n ) {\n return this.getContract().write.updateAtomicRequest(\n [offerToken, wantToken, request],\n { account: ownerAddress, chain: this.viemChain },\n );\n }\n\n /**\n * Get user's atomic request details directly from storage.\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public userAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.userAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n}\n"],"names":["NucleusAtomicQueueHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_ATOMIC_QUEUE_ABIS","client","getContract","user","offerToken","wantToken","request","users","runData","solver","ownerAddress"],"mappings":";;;;;;;AA8BO,MAAMA,EAA0B;AAAA,EAGrC,YACUC,GACAC,GACAC,GACR;AANM,IAAAC,EAAA;AAGE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EAAA;AAAA,EAG7B,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAAE,aACzCC,IAAMC,EAA0B,KAAK,KAAK,EAAE,aAC5CC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAatC,qBACLE,GACAC,GACAC,GACA;AACA,WAAO,KAAK,cAAc,KAAK,qBAAqB;AAAA,MAClDF;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,qBACLD,GACAD,GACAG,GACA;AACA,WAAO,KAAK,cAAc,KAAK,qBAAqB;AAAA,MAClDF;AAAA,MACAD;AAAA,MACAG;AAAA,IAAA,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWI,MACLF,GACAC,GACAE,GACAC,GACAC,GACA;AACO,WAAA,KAAK,cAAc,MAAM;AAAA,MAC9B,CAACL,GAAYC,GAAWE,GAAOC,GAASC,CAAM;AAAA,MAC9C;AAAA,QACE,SAAS,KAAK,aAAa;AAAA,QAC3B,OAAO,KAAK;AAAA,MAAA;AAAA,IAEhB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASK,oBACLL,GACAC,GACAC,GACAI,GACA;AACO,WAAA,KAAK,cAAc,MAAM;AAAA,MAC9B,CAACN,GAAYC,GAAWC,CAAO;AAAA,MAC/B,EAAE,SAASI,GAAc,OAAO,KAAK,UAAU;AAAA,IACjD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASK,kBACLP,GACAC,GACAC,GACA;AACA,WAAO,KAAK,cAAc,KAAK,kBAAkB;AAAA,MAC/CF;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;"}
1
+ {"version":3,"file":"nucleus-atomic-queue-handler.js","sources":["../../../lib/contracts/handlers/nucleus-atomic-queue-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n Account,\n} from 'viem';\nimport { Chain } from 'viem';\nimport { Chain as LocalChain, VIEM_CHAINS } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { NUCLEUS_ATOMIC_QUEUE_ABIS } from '../abis/nucleus-atomic-queue-abis';\n\nexport type AtomicRequest = {\n deadline: bigint;\n atomicPrice: bigint;\n offerAmount: bigint;\n inSolve: boolean;\n};\n\nexport type SolveMetaData = {\n user: Address;\n flags: number;\n assetsToOffer: bigint;\n assetsForWant: bigint;\n};\n\n/**\n * Handler for the `AtomicQueue` contract.\n */\nexport class NucleusAtomicQueueHandler {\n private viemChain: Chain;\n\n constructor(\n private chain: LocalChain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusAtomicQueue as Address;\n const abi = NUCLEUS_ATOMIC_QUEUE_ABIS[this.chain].AtomicQueue;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the atomic request details for a specific user (wallet address).\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public getUserAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.getUserAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n\n /**\n * Check if an atomic request is valid.\n * @param offerToken Token being offered\n * @param user User address\n * @param request Atomic request details\n */\n public isAtomicRequestValid(\n offerToken: Address,\n user: Address,\n request: AtomicRequest,\n ) {\n return this.getContract().read.isAtomicRequestValid([\n offerToken,\n user,\n request,\n ]);\n }\n\n /**\n * Solve atomic requests for multiple users.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param users Array of user addresses\n * @param runData Execution data for the solve\n * @param solver Address of the solver\n */\n public solve(\n offerToken: Address,\n wantToken: Address,\n users: Address[],\n runData: `0x${string}`,\n solver: Address,\n ) {\n return this.getContract().write.solve(\n [offerToken, wantToken, users, runData, solver],\n {\n account: this.walletClient.account as Account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Update an atomic request.\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n * @param request New atomic request details\n */\n public updateAtomicRequest(\n offerToken: Address,\n wantToken: Address,\n request: AtomicRequest,\n ownerAddress: Address,\n ) {\n return this.getContract().write.updateAtomicRequest(\n [offerToken, wantToken, request],\n { account: ownerAddress, chain: this.viemChain },\n );\n }\n\n /**\n * Get user's atomic request details directly from storage.\n * @param user User address\n * @param offerToken Token being offered\n * @param wantToken Token being requested\n */\n public userAtomicRequest(\n user: Address,\n offerToken: Address,\n wantToken: Address,\n ) {\n return this.getContract().read.userAtomicRequest([\n user,\n offerToken,\n wantToken,\n ]);\n }\n}\n"],"names":["NucleusAtomicQueueHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_ATOMIC_QUEUE_ABIS","client","getContract","user","offerToken","wantToken","request","users","runData","solver","ownerAddress"],"mappings":";;;;;;;AA8BO,MAAMA,EAA0B;AAAA,EAGrC,YACUC,GACAC,GACAC,GACR;AANM,IAAAC,EAAA;AAGE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EAAA;AAAA,EAG7B,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAC1C,oBACGC,IAAMC,EAA0B,KAAK,KAAK,EAAE,aAC5CC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAatC,qBACLE,GACAC,GACAC,GACA;AACA,WAAO,KAAK,cAAc,KAAK,qBAAqB;AAAA,MAClDF;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,qBACLD,GACAD,GACAG,GACA;AACA,WAAO,KAAK,cAAc,KAAK,qBAAqB;AAAA,MAClDF;AAAA,MACAD;AAAA,MACAG;AAAA,IAAA,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWI,MACLF,GACAC,GACAE,GACAC,GACAC,GACA;AACO,WAAA,KAAK,cAAc,MAAM;AAAA,MAC9B,CAACL,GAAYC,GAAWE,GAAOC,GAASC,CAAM;AAAA,MAC9C;AAAA,QACE,SAAS,KAAK,aAAa;AAAA,QAC3B,OAAO,KAAK;AAAA,MAAA;AAAA,IAEhB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASK,oBACLL,GACAC,GACAC,GACAI,GACA;AACO,WAAA,KAAK,cAAc,MAAM;AAAA,MAC9B,CAACN,GAAYC,GAAWC,CAAO;AAAA,MAC/B,EAAE,SAASI,GAAc,OAAO,KAAK,UAAU;AAAA,IACjD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASK,kBACLP,GACAC,GACAC,GACA;AACA,WAAO,KAAK,cAAc,KAAK,kBAAkB;AAAA,MAC/CF;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;"}
@@ -1,2 +1,2 @@
1
- "use strict";var h=Object.defineProperty;var C=(n,t,e)=>t in n?h(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var l=(n,t,e)=>C(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../constants-DA2xUb9r.cjs"),m=require("../abis/nucleus-boring-vault-abis.cjs"),p=require("../addresses.cjs"),S=require("../../getContract-3QbyfZBF.cjs");class b{constructor(t,e,a){l(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=a,this.viemChain=g.VIEM_CHAINS[t]}getContract(){const t=p.CONTRACT_ADDRESSES[this.chain].NucleusBoringVault,e=m.NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault,a={public:this.publicClient,wallet:this.walletClient};return S.getContract({address:t,abi:e,client:a})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}getTotalSupply(){return this.getContract().read.totalSupply()}balanceOf(t){return this.getContract().read.balanceOf([t])}totalSupply(){return this.getContract().read.totalSupply()}approve(t,e,a){return this.getContract().write.approve([e,a],{account:t,chain:this.viemChain})}transfer(t,e,a){return{transact:()=>this.getContract().write.transfer([e,a],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transfer([e,a],{account:t})}}transferFrom(t,e,a,r){return{transact:()=>this.getContract().write.transferFrom([e,a,r],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transferFrom([e,a,r],{account:t})}}permit(t){const{account:e,owner:a,spender:r,value:i,deadline:c,v:s,r:o,s:u}=t;return{transact:()=>this.getContract().write.permit([a,r,i,c,s,o,u],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.permit([a,r,i,c,s,o,u],{account:e})}}}exports.NucleusBoringVaultHandler=b;
1
+ "use strict";var l=Object.defineProperty;var C=(a,t,e)=>t in a?l(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var c=(a,t,e)=>C(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../constants-DA2xUb9r.cjs"),m=require("../abis/nucleus-boring-vault-abis.cjs"),p=require("../addresses.cjs"),S=require("../tokens.cjs"),_=require("../../getContract-3QbyfZBF.cjs");class b{constructor(t,e,n){c(this,"viemChain");c(this,"token");this.chain=t,this.walletClient=e,this.publicClient=n,this.viemChain=g.VIEM_CHAINS[t],this.token=S.UnifiToken.unifiETH}withToken(t){return this.token=t,this}getContract(){const t=p.NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain].NucleusBoringVault,e=m.NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault,n={public:this.publicClient,wallet:this.walletClient};return _.getContract({address:t,abi:e,client:n})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}balanceOf(t){return this.getContract().read.balanceOf([t])}totalSupply(){return this.getContract().read.totalSupply()}approve(t,e,n){return this.getContract().write.approve([e,n],{account:t,chain:this.viemChain})}transfer(t,e,n){return{transact:()=>this.getContract().write.transfer([e,n],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transfer([e,n],{account:t})}}transferFrom(t,e,n,i){return{transact:()=>this.getContract().write.transferFrom([e,n,i],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transferFrom([e,n,i],{account:t})}}permit(t){const{account:e,owner:n,spender:i,value:r,deadline:s,v:o,r:u,s:h}=t;return{transact:()=>this.getContract().write.permit([n,i,r,s,o,u,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.permit([n,i,r,s,o,u,h],{account:e})}}}exports.NucleusBoringVaultHandler=b;
2
2
  //# sourceMappingURL=nucleus-boring-vault-handler.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nucleus-boring-vault-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":"iaA4BO,MAAMA,CAA0B,CAYrC,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,kBAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CAAA,CAS7B,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAC1C,mBACGC,EAAMC,EAAA,0BAA0B,KAAK,KAAK,EAAE,YAC5CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CActC,aAAaE,EAAgBC,EAAkB,CAC7C,OAAA,KAAK,cAAc,KAAK,UAAU,CAACD,EAAOC,CAAO,CAAC,CAAA,CAQpD,gBAAiB,CACtB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAStC,UAAUC,EAAwB,CACvC,OAAO,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAa,CAAC,CAAA,CAQnD,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAWtC,QACLA,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAAgBC,CAAK,EAAG,CAC/D,QAASF,EACT,MAAO,KAAK,SAAA,CACb,CAAA,CAeI,SAASA,EAAwBG,EAAoBD,EAAe,CAWlE,MAAA,CAAE,SAVQ,IACf,KAAK,YAAY,EAAE,MAAM,SAAS,CAACC,EAAWD,CAAK,EAAG,CACpD,QAASF,EACT,MAAO,KAAK,SAAA,CACb,EAMgB,SALF,IACf,KAAK,YAAY,EAAE,YAAY,SAAS,CAACG,EAAWD,CAAK,EAAG,CAC1D,QAASF,CAAA,CACV,CAEyB,CAAA,CAgBvB,aACLA,EACAI,EACAD,EACAD,EACA,CAYO,MAAA,CAAE,SAXQ,IACf,KAAK,cAAc,MAAM,aAAa,CAACE,EAAaD,EAAWD,CAAK,EAAG,CACrE,QAASF,EACT,MAAO,KAAK,SAAA,CACb,EAOgB,SANF,IACf,KAAK,cAAc,YAAY,aAC7B,CAACI,EAAaD,EAAWD,CAAK,EAC9B,CAAE,QAASF,CAAc,CAC3B,CAE0B,CAAA,CAqBvB,OAAOK,EAAsB,CAC5B,KAAA,CAAE,QAAAC,EAAS,MAAAR,EAAO,QAAAC,EAAS,MAAAG,EAAO,SAAAK,EAAU,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,EAAML,EAYvD,MAAA,CAAE,SAXQ,IACf,KAAK,cAAc,MAAM,OACvB,CAACP,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,EAAS,MAAO,KAAK,SAAU,CACnC,EAOiB,SANF,IACf,KAAK,cAAc,YAAY,OAC7B,CAACR,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,CAAQ,CACZ,CAE0B,CAAA,CAEhC"}
1
+ {"version":3,"file":"nucleus-boring-vault-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';\nimport { UnifiToken } from '../tokens';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n private token: UnifiToken;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","UnifiToken","token","address","NUCLEUS_CONTRACT_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":"4bA6BO,MAAMA,CAA0B,CAarC,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,MAAQK,EAAAA,WAAW,QAAA,CAUnB,UAAUC,EAAmB,CAClC,YAAK,MAAQA,EACN,IAAA,CASF,aAAc,CACnB,MAAMC,EAAUC,EAAAA,2BAA2B,KAAK,KAAK,EAAE,KAAK,KAAK,EAC9D,mBACGC,EAAMC,EAAA,0BAA0B,KAAK,KAAK,EAAE,YAC5CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CActC,aAAaE,EAAgBC,EAAkB,CAC7C,OAAA,KAAK,cAAc,KAAK,UAAU,CAACD,EAAOC,CAAO,CAAC,CAAA,CASpD,UAAUC,EAAwB,CACvC,OAAO,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAa,CAAC,CAAA,CAQnD,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAWtC,QACLA,EACAC,EACAC,EACA,CACO,OAAA,KAAK,cAAc,MAAM,QAAQ,CAACD,EAAgBC,CAAK,EAAG,CAC/D,QAASF,EACT,MAAO,KAAK,SAAA,CACb,CAAA,CAeI,SAASA,EAAwBG,EAAoBD,EAAe,CAWlE,MAAA,CAAE,SAVQ,IACf,KAAK,YAAY,EAAE,MAAM,SAAS,CAACC,EAAWD,CAAK,EAAG,CACpD,QAASF,EACT,MAAO,KAAK,SAAA,CACb,EAMgB,SALF,IACf,KAAK,YAAY,EAAE,YAAY,SAAS,CAACG,EAAWD,CAAK,EAAG,CAC1D,QAASF,CAAA,CACV,CAEyB,CAAA,CAgBvB,aACLA,EACAI,EACAD,EACAD,EACA,CAYO,MAAA,CAAE,SAXQ,IACf,KAAK,cAAc,MAAM,aAAa,CAACE,EAAaD,EAAWD,CAAK,EAAG,CACrE,QAASF,EACT,MAAO,KAAK,SAAA,CACb,EAOgB,SANF,IACf,KAAK,cAAc,YAAY,aAC7B,CAACI,EAAaD,EAAWD,CAAK,EAC9B,CAAE,QAASF,CAAc,CAC3B,CAE0B,CAAA,CAqBvB,OAAOK,EAAsB,CAC5B,KAAA,CAAE,QAAAC,EAAS,MAAAR,EAAO,QAAAC,EAAS,MAAAG,EAAO,SAAAK,EAAU,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,EAAML,EAYvD,MAAA,CAAE,SAXQ,IACf,KAAK,cAAc,MAAM,OACvB,CAACP,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,EAAS,MAAO,KAAK,SAAU,CACnC,EAOiB,SANF,IACf,KAAK,cAAc,YAAY,OAC7B,CAACR,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,CAAQ,CACZ,CAE0B,CAAA,CAEhC"}
@@ -1,5 +1,6 @@
1
1
  import { WalletClient, PublicClient, Address, GetContractReturnType } from 'viem';
2
2
  import { Chain, ViemChain } from '../../chains/constants';
3
+ import { UnifiToken } from '../tokens';
3
4
  export type PermitParams = {
4
5
  account: Address;
5
6
  owner: Address;
@@ -19,6 +20,7 @@ export declare class NucleusBoringVaultHandler {
19
20
  private walletClient;
20
21
  private publicClient;
21
22
  private viemChain;
23
+ private token;
22
24
  /**
23
25
  * Create the handler for processing UniFi tokens.
24
26
  *
@@ -29,6 +31,14 @@ export declare class NucleusBoringVaultHandler {
29
31
  * interactions.
30
32
  */
31
33
  constructor(chain: Chain, walletClient: WalletClient, publicClient: PublicClient);
34
+ /**
35
+ * Set the UniFi token to use for executing transactions on the
36
+ * contract.
37
+ *
38
+ * @param token UniFi token to use for the handler.
39
+ * @returns The handler.
40
+ */
41
+ withToken(token: UnifiToken): this;
32
42
  /**
33
43
  * Get the contract. This is a method because the typings are complex
34
44
  * and lost when trying to make it a member.
@@ -15194,12 +15204,6 @@ export declare class NucleusBoringVaultHandler {
15194
15204
  * @returns Allowance for the given owner and spender.
15195
15205
  */
15196
15206
  getAllowance(owner: Address, spender: Address): Promise<bigint>;
15197
- /**
15198
- * Get the total supply of the token.
15199
- *
15200
- * @returns Total supply of the token.
15201
- */
15202
- getTotalSupply(): Promise<bigint>;
15203
15207
  /**
15204
15208
  * Check the token balance of the wallet.
15205
15209
  *