@allbridge/bridge-core-sdk 3.24.0 → 3.25.0-alpha.1

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 (55) hide show
  1. package/dist/browser/index.js +1 -1
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/index.js.map +4 -4
  5. package/dist/esm/index.js +1 -1
  6. package/dist/esm/index.js.map +4 -4
  7. package/dist/src/client/core-api/core-api-mapper.js +2 -1
  8. package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
  9. package/dist/src/client/core-api/core-api.model.d.ts +6 -1
  10. package/dist/src/client/core-api/core-api.model.js.map +1 -1
  11. package/dist/src/exceptions/exceptions.d.ts +4 -0
  12. package/dist/src/exceptions/exceptions.js +8 -1
  13. package/dist/src/exceptions/exceptions.js.map +1 -1
  14. package/dist/src/index.d.ts +2 -0
  15. package/dist/src/index.js +2 -0
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/models/index.d.ts +4 -0
  18. package/dist/src/models/index.js +4 -1
  19. package/dist/src/models/index.js.map +1 -1
  20. package/dist/src/services/index.d.ts +2 -0
  21. package/dist/src/services/index.js +3 -0
  22. package/dist/src/services/index.js.map +1 -1
  23. package/dist/src/services/models/abi/PortfolioToken.d.ts +589 -0
  24. package/dist/src/services/models/abi/PortfolioToken.js +770 -0
  25. package/dist/src/services/models/abi/PortfolioToken.js.map +1 -0
  26. package/dist/src/services/yield/evm/index.d.ts +24 -0
  27. package/dist/src/services/yield/evm/index.js +64 -0
  28. package/dist/src/services/yield/evm/index.js.map +1 -0
  29. package/dist/src/services/yield/index.d.ts +65 -0
  30. package/dist/src/services/yield/index.js +133 -0
  31. package/dist/src/services/yield/index.js.map +1 -0
  32. package/dist/src/services/yield/models/index.d.ts +2 -0
  33. package/dist/src/services/yield/models/index.js +21 -0
  34. package/dist/src/services/yield/models/index.js.map +1 -0
  35. package/dist/src/services/yield/models/yield.d.ts +13 -0
  36. package/dist/src/services/yield/models/yield.js +7 -0
  37. package/dist/src/services/yield/models/yield.js.map +1 -0
  38. package/dist/src/services/yield/models/yield.model.d.ts +94 -0
  39. package/dist/src/services/yield/models/yield.model.js +3 -0
  40. package/dist/src/services/yield/models/yield.model.js.map +1 -0
  41. package/dist/src/services/yield/raw-yield-transaction-builder.d.ts +36 -0
  42. package/dist/src/services/yield/raw-yield-transaction-builder.js +42 -0
  43. package/dist/src/services/yield/raw-yield-transaction-builder.js.map +1 -0
  44. package/dist/src/services/yield/trx/index.d.ts +18 -0
  45. package/dist/src/services/yield/trx/index.js +70 -0
  46. package/dist/src/services/yield/trx/index.js.map +1 -0
  47. package/dist/src/services/yield/validations.d.ts +15 -0
  48. package/dist/src/services/yield/validations.js +25 -0
  49. package/dist/src/services/yield/validations.js.map +1 -0
  50. package/dist/src/tokens-info/tokens-info.model.d.ts +8 -6
  51. package/dist/src/tokens-info/tokens-info.model.js.map +1 -1
  52. package/dist/src/version.d.ts +1 -1
  53. package/dist/src/version.js +1 -1
  54. package/dist/src/version.js.map +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PortfolioToken.js","sourceRoot":"","sources":["../../../../../src/services/models/abi/PortfolioToken.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG;IACf,GAAG,EAAE;QACH;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,aAAa;SACpB;QACD;YACE,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE;gBACN;oBACE,OAAO,EAAE,IAAI;oBACb,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,OAAO;oBACb,I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,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP;oBACE,YAAY,EAAE,MAAM;oBACpB,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,MAAM;iBACb;aACF;YACD,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP;oBACE,YAAY,EAAE,MAAM;oBACpB,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,MAAM;iBACb;aACF;YACD,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,MAAM,EAAE;gBACN;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,eAAe;oBACrB,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,YAAY;YAC7B,IAAI,EAAE,UAAU;SACjB;QACD;YACE,eAAe,EAAE,SAAS;YAC1B,IAAI,EAAE,SAAS;SAChB;KACF;CACO,CAAC;AACX,kBAAe,QAAQ,CAAC","sourcesContent":["const artifact = {\n abi: [\n {\n inputs: [\n {\n internalType: \"string\",\n name: \"tokenName_\",\n type: \"string\",\n },\n {\n internalType: \"string\",\n name: \"tokenSymbol_\",\n type: \"string\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"value\",\n type: \"uint256\",\n },\n ],\n name: \"Approval\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: \"address\",\n name: \"user\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"lpAmount\",\n type: \"uint256\",\n },\n ],\n name: \"Deposited\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n ],\n name: \"DepositedRewards\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"from\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"to\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256[4]\",\n name: \"values\",\n type: \"uint256[4]\",\n },\n ],\n name: \"MultiTransfer\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"previousOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"from\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"to\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"value\",\n type: \"uint256\",\n },\n ],\n name: \"Transfer\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: \"address\",\n name: \"user\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"Withdrawn\",\n type: \"event\",\n },\n {\n stateMutability: \"payable\",\n type: \"fallback\",\n },\n {\n inputs: [],\n name: \"NUM_TOKENS\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n ],\n name: \"allowance\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"approve\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n ],\n name: \"balanceOf\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"decimals\",\n outputs: [\n {\n internalType: \"uint8\",\n name: \"\",\n type: \"uint8\",\n },\n ],\n stateMutability: \"pure\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"subtractedValue\",\n type: \"uint256\",\n },\n ],\n name: \"decreaseAllowance\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"minVirtualAmount\",\n type: \"uint256\",\n },\n ],\n name: \"deposit\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"depositRewards\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"getEstimatedAmountOnDeposit\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"getRewardsAmount\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"user\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"virtualAmount\",\n type: \"uint256\",\n },\n ],\n name: \"getWithdrawProportionAmount\",\n outputs: [\n {\n internalType: \"uint256[4]\",\n name: \"\",\n type: \"uint256[4]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"addedValue\",\n type: \"uint256\",\n },\n ],\n name: \"increaseAllowance\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"name\",\n outputs: [\n {\n internalType: \"string\",\n name: \"\",\n type: \"string\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [\n {\n internalType: \"address\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n name: \"pools\",\n outputs: [\n {\n internalType: \"contract IPool\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n {\n internalType: \"contract IPool\",\n name: \"pool\",\n type: \"address\",\n },\n ],\n name: \"setPool\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"subBalanceOf\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"subDepositRewards\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"subTotalSupply\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"to\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"subTransfer\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"from\",\n type: \"address\",\n },\n {\n internalType: \"address\",\n name: \"to\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"subTransferFrom\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"virtualAmount\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"index\",\n type: \"uint256\",\n },\n ],\n name: \"subWithdraw\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"symbol\",\n outputs: [\n {\n internalType: \"string\",\n name: \"\",\n type: \"string\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n name: \"tokens\",\n outputs: [\n {\n internalType: \"contract IERC20\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"totalSupply\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"to\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"transfer\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"from\",\n type: \"address\",\n },\n {\n internalType: \"address\",\n name: \"to\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"transferFrom\",\n outputs: [\n {\n internalType: \"bool\",\n name: \"\",\n type: \"bool\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"virtualAmount\",\n type: \"uint256\",\n },\n ],\n name: \"withdraw\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n stateMutability: \"payable\",\n type: \"receive\",\n },\n ],\n} as const;\nexport default artifact;\n"]}
@@ -0,0 +1,24 @@
1
+ import { ChainType } from "../../../chains/chain.enums";
2
+ import { AllbridgeCoreClient } from "../../../client/core-api/core-client-base";
3
+ import { EssentialWeb3, RawTransaction } from "../../models";
4
+ import { ChainYieldService, YieldBalanceParams, YieldDepositParams, YieldGetEstimatedAmountOnDepositParams, YieldGetWithdrawProportionAmountParams, YieldWithdrawParams } from "../models";
5
+ export declare class EvmYieldService extends ChainYieldService {
6
+ web3: EssentialWeb3;
7
+ api: AllbridgeCoreClient;
8
+ chainType: ChainType.EVM;
9
+ constructor(web3: EssentialWeb3, api: AllbridgeCoreClient);
10
+ balanceOf(params: YieldBalanceParams): Promise<string>;
11
+ getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams): Promise<string>;
12
+ getWithdrawProportionAmount(params: YieldGetWithdrawProportionAmountParams): Promise<string[]>;
13
+ buildRawTransactionDeposit(params: YieldDepositParams): Promise<RawTransaction>;
14
+ buildRawTransactionWithdraw(params: YieldWithdrawParams): Promise<RawTransaction>;
15
+ buildTxParams(params: {
16
+ owner: string;
17
+ yieldAddress: string;
18
+ }): {
19
+ from: string;
20
+ to: string;
21
+ value: string;
22
+ };
23
+ private getYieldContract;
24
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EvmYieldService = void 0;
7
+ const chain_enums_1 = require("../../../chains/chain.enums");
8
+ const calculation_1 = require("../../../utils/calculation");
9
+ const constants_1 = require("../../../utils/calculation/constants");
10
+ const PortfolioToken_1 = __importDefault(require("../../models/abi/PortfolioToken"));
11
+ const models_1 = require("../models");
12
+ class EvmYieldService extends models_1.ChainYieldService {
13
+ web3;
14
+ api;
15
+ chainType = chain_enums_1.ChainType.EVM;
16
+ constructor(web3, api) {
17
+ super();
18
+ this.web3 = web3;
19
+ this.api = api;
20
+ }
21
+ async balanceOf(params) {
22
+ const vCYD = (await this.getYieldContract(params.token.yieldAddress).methods.balanceOf(params.owner).call()).toString();
23
+ return (0, calculation_1.convertIntAmountToFloat)(vCYD, constants_1.SYSTEM_PRECISION).toFixed();
24
+ }
25
+ async getEstimatedAmountOnDeposit(params) {
26
+ const amountInt = (0, calculation_1.convertFloatAmountToInt)(params.amount, params.token.decimals).toFixed();
27
+ const resultInt = (await this.getYieldContract(params.token.yieldAddress)
28
+ .methods.getEstimatedAmountOnDeposit(amountInt, params.token.yieldId)
29
+ .call()).toString();
30
+ return (0, calculation_1.convertIntAmountToFloat)(resultInt, constants_1.SYSTEM_PRECISION).toFixed();
31
+ }
32
+ async getWithdrawProportionAmount(params) {
33
+ const amountInt = (0, calculation_1.convertFloatAmountToInt)(params.amount, constants_1.SYSTEM_PRECISION).toFixed();
34
+ return await this.getYieldContract(params.cydToken.yieldAddress)
35
+ .methods.getWithdrawProportionAmount(params.owner, amountInt)
36
+ .call();
37
+ }
38
+ async buildRawTransactionDeposit(params) {
39
+ return Promise.resolve({
40
+ ...this.buildTxParams({ owner: params.owner, yieldAddress: params.token.yieldAddress }),
41
+ data: this.getYieldContract(params.token.yieldAddress)
42
+ .methods.deposit(params.amount, params.token.yieldId, params.minVirtualAmount)
43
+ .encodeABI(),
44
+ });
45
+ }
46
+ async buildRawTransactionWithdraw(params) {
47
+ return Promise.resolve({
48
+ ...this.buildTxParams({ owner: params.owner, yieldAddress: params.token.yieldAddress }),
49
+ data: this.getYieldContract(params.token.yieldAddress).methods.withdraw(params.amount).encodeABI(),
50
+ });
51
+ }
52
+ buildTxParams(params) {
53
+ return {
54
+ from: params.owner,
55
+ to: params.yieldAddress,
56
+ value: "0",
57
+ };
58
+ }
59
+ getYieldContract(contractAddress) {
60
+ return new this.web3.eth.Contract(PortfolioToken_1.default.abi, contractAddress);
61
+ }
62
+ }
63
+ exports.EvmYieldService = EvmYieldService;
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/yield/evm/index.ts"],"names":[],"mappings":";;;;;;AACA,6DAAwD;AAExD,4DAA8F;AAC9F,oEAAwE;AAExE,qFAAoD;AACpD,sCAOmB;AAEnB,MAAa,eAAgB,SAAQ,0BAAiB;IAI3C;IACA;IAJT,SAAS,GAAkB,uBAAS,CAAC,GAAG,CAAC;IAEzC,YACS,IAAmB,EACnB,GAAwB;QAE/B,KAAK,EAAE,CAAC;QAHD,SAAI,GAAJ,IAAI,CAAe;QACnB,QAAG,GAAH,GAAG,CAAqB;IAGjC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAA0B;QACxC,MAAM,IAAI,GAAG,CACX,MAAM,IAAI,CA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,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACvF,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC;iBACnD,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC;iBAC7E,SAAS,EAAE;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,MAA2B;QAC3D,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACvF,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE;SACnG,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,MAA+C;QAC3D,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,KAAK;YAClB,EAAE,EAAE,MAAM,CAAC,YAAY;YACvB,KAAK,EAAE,GAAG;SACX,CAAC;IACJ,CAAC;IAEO,gBAAgB,CAAC,eAAuB;QAC9C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,wBAAK,CAAC,GAAG,EAAE,eAAe,CAA+B,CAAC;IAC9F,CAAC;CACF;AA7DD,0CA6DC","sourcesContent":["import { Contract } from \"web3\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { convertFloatAmountToInt, convertIntAmountToFloat } from \"../../../utils/calculation\";\nimport { SYSTEM_PRECISION } from \"../../../utils/calculation/constants\";\nimport { EssentialWeb3, RawTransaction } from \"../../models\";\nimport Yield from \"../../models/abi/PortfolioToken\";\nimport {\n ChainYieldService,\n YieldBalanceParams,\n YieldDepositParams,\n YieldGetEstimatedAmountOnDepositParams,\n YieldGetWithdrawProportionAmountParams,\n YieldWithdrawParams,\n} from \"../models\";\n\nexport class EvmYieldService extends ChainYieldService {\n chainType: ChainType.EVM = ChainType.EVM;\n\n constructor(\n public web3: EssentialWeb3,\n public api: AllbridgeCoreClient\n ) {\n super();\n }\n\n async balanceOf(params: YieldBalanceParams): Promise<string> {\n const vCYD = (\n await this.getYieldContract(params.token.yieldAddress).methods.balanceOf(params.owner).call()\n ).toString();\n return convertIntAmountToFloat(vCYD, SYSTEM_PRECISION).toFixed();\n }\n\n async getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams): Promise<string> {\n const amountInt = convertFloatAmountToInt(params.amount, params.token.decimals).toFixed();\n const resultInt = (\n await this.getYieldContract(params.token.yieldAddress)\n .methods.getEstimatedAmountOnDeposit(amountInt, params.token.yieldId)\n .call()\n ).toString();\n return convertIntAmountToFloat(resultInt, SYSTEM_PRECISION).toFixed();\n }\n\n async getWithdrawProportionAmount(params: YieldGetWithdrawProportionAmountParams): Promise<string[]> {\n const amountInt = convertFloatAmountToInt(params.amount, SYSTEM_PRECISION).toFixed();\n return await this.getYieldContract(params.cydToken.yieldAddress)\n .methods.getWithdrawProportionAmount(params.owner, amountInt)\n .call();\n }\n\n async buildRawTransactionDeposit(params: YieldDepositParams): Promise<RawTransaction> {\n return Promise.resolve({\n ...this.buildTxParams({ owner: params.owner, yieldAddress: params.token.yieldAddress }),\n data: this.getYieldContract(params.token.yieldAddress)\n .methods.deposit(params.amount, params.token.yieldId, params.minVirtualAmount)\n .encodeABI(),\n });\n }\n\n async buildRawTransactionWithdraw(params: YieldWithdrawParams): Promise<RawTransaction> {\n return Promise.resolve({\n ...this.buildTxParams({ owner: params.owner, yieldAddress: params.token.yieldAddress }),\n data: this.getYieldContract(params.token.yieldAddress).methods.withdraw(params.amount).encodeABI(),\n });\n }\n\n buildTxParams(params: { owner: string; yieldAddress: string }) {\n return {\n from: params.owner,\n to: params.yieldAddress,\n value: \"0\",\n };\n }\n\n private getYieldContract(contractAddress: string) {\n return new this.web3.eth.Contract(Yield.abi, contractAddress) as Contract<typeof Yield.abi>;\n }\n}\n"]}
@@ -0,0 +1,65 @@
1
+ import { AllbridgeCoreClient } from "../../client/core-api/core-client-base";
2
+ import { AllbridgeCoreClientFiltered } from "../../client/core-api/core-client-filtered";
3
+ import { AllbridgeCoreSdkOptions } from "../../index";
4
+ import { NodeRpcUrlsConfig } from "../index";
5
+ import { Provider } from "../models";
6
+ import { TokenService } from "../token";
7
+ import { ChainYieldService, CYDToken, YieldBalanceParams, YieldCheckAllowanceParams, YieldGetAllowanceParams, YieldGetEstimatedAmountOnDepositParams, YieldGetWithdrawProportionAmountParams, YieldWithdrawAmount } from "./models";
8
+ import { RawYieldTransactionBuilder } from "./raw-yield-transaction-builder";
9
+ export interface YieldService {
10
+ rawTxBuilder: RawYieldTransactionBuilder;
11
+ /**
12
+ * Returns a list of supported {@link CYDToken}.
13
+ */
14
+ getCYDTokens(): Promise<CYDToken[]>;
15
+ /**
16
+ * Get amount of tokens approved for Yield
17
+ * @param provider - will be used to access the network
18
+ * @param params See {@link YieldGetAllowanceParams}
19
+ * @returns the amount of approved tokens
20
+ */
21
+ getAllowance(params: YieldGetAllowanceParams, provider?: Provider): Promise<string>;
22
+ /**
23
+ * Check if the amount of approved tokens is enough
24
+ * @param params See {@link YieldCheckAllowanceParams}
25
+ * @param provider - will be used to access the network
26
+ * @returns true if the amount of approved tokens is enough to make a transfer
27
+ */
28
+ checkAllowance(params: YieldCheckAllowanceParams, provider?: Provider): Promise<boolean>;
29
+ /**
30
+ * Get token balance
31
+ * @param params
32
+ * @param provider
33
+ * @returns Token balance
34
+ */
35
+ balanceOf(params: YieldBalanceParams, provider?: Provider): Promise<string>;
36
+ /**
37
+ * Calculates the amount of CYD tokens that will be deposited
38
+ * @param params - will be used to access the network
39
+ * @param provider - will be used to access the network
40
+ * @returns amount
41
+ */
42
+ getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams, provider?: Provider): Promise<string>;
43
+ /**
44
+ * Calculates the amounts of tokens ({@link YieldWithdrawAmount}) will be withdrawn
45
+ * @param params
46
+ * @param provider - will be used to access the network
47
+ * @returns amounts
48
+ */
49
+ getWithdrawAmounts(params: YieldGetWithdrawProportionAmountParams, provider?: Provider): Promise<YieldWithdrawAmount[]>;
50
+ }
51
+ export declare class DefaultYieldService implements YieldService {
52
+ private api;
53
+ private nodeRpcUrlsConfig;
54
+ private params;
55
+ private tokenService;
56
+ rawTxBuilder: RawYieldTransactionBuilder;
57
+ constructor(api: AllbridgeCoreClientFiltered, nodeRpcUrlsConfig: NodeRpcUrlsConfig, params: AllbridgeCoreSdkOptions, tokenService: TokenService);
58
+ getCYDTokens(): Promise<CYDToken[]>;
59
+ getAllowance(params: YieldGetAllowanceParams, provider?: Provider): Promise<string>;
60
+ checkAllowance(params: YieldCheckAllowanceParams, provider?: Provider): Promise<boolean>;
61
+ balanceOf(params: YieldBalanceParams, provider?: Provider): Promise<string>;
62
+ getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams, provider?: Provider): Promise<string>;
63
+ getWithdrawAmounts(params: YieldGetWithdrawProportionAmountParams, provider?: Provider): Promise<YieldWithdrawAmount[]>;
64
+ }
65
+ export declare function getChainYieldService(chainSymbol: string, api: AllbridgeCoreClient, nodeRpcUrlsConfig: NodeRpcUrlsConfig, ownerAddress: string, provider?: Provider): ChainYieldService;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultYieldService = void 0;
4
+ exports.getChainYieldService = getChainYieldService;
5
+ const tronweb_1 = require("tronweb");
6
+ const web3_1 = require("web3");
7
+ const chains_1 = require("../../chains");
8
+ const exceptions_1 = require("../../exceptions");
9
+ const index_1 = require("../../index");
10
+ const calculation_1 = require("../../utils/calculation");
11
+ const constants_1 = require("../../utils/calculation/constants");
12
+ const utils_1 = require("../../utils/utils");
13
+ const evm_1 = require("./evm");
14
+ const raw_yield_transaction_builder_1 = require("./raw-yield-transaction-builder");
15
+ const trx_1 = require("./trx");
16
+ const validations_1 = require("./validations");
17
+ class DefaultYieldService {
18
+ api;
19
+ nodeRpcUrlsConfig;
20
+ params;
21
+ tokenService;
22
+ rawTxBuilder;
23
+ constructor(api, nodeRpcUrlsConfig, params, tokenService) {
24
+ this.api = api;
25
+ this.nodeRpcUrlsConfig = nodeRpcUrlsConfig;
26
+ this.params = params;
27
+ this.tokenService = tokenService;
28
+ this.rawTxBuilder = new raw_yield_transaction_builder_1.DefaultRawYieldTransactionBuilder(api, nodeRpcUrlsConfig, params, tokenService);
29
+ }
30
+ async getCYDTokens() {
31
+ const result = [];
32
+ const chainMap = await this.api.getChainDetailsMap("pool");
33
+ Object.values(chainMap).forEach((chainData) => {
34
+ if (chainData.yieldAddress) {
35
+ const cydToken = chainData.tokens.find((t) => t.tokenAddress === chainData.yieldAddress);
36
+ const tokens = chainData.tokens.filter(validations_1.isYieldSupported);
37
+ if (tokens.length > 0) {
38
+ const cydDefined = cydToken ?? {
39
+ allbridgeChainId: chainData.allbridgeChainId,
40
+ apr: "",
41
+ apr30d: "",
42
+ apr7d: "",
43
+ bridgeAddress: chainData.bridgeAddress,
44
+ chainId: chainData.chainId,
45
+ chainName: chainData.name,
46
+ chainSymbol: chainData.chainSymbol,
47
+ chainType: chainData.chainType,
48
+ confirmations: chainData.confirmations,
49
+ decimals: 3,
50
+ feeShare: "",
51
+ lpRate: "",
52
+ name: "Core Yield",
53
+ poolAddress: "",
54
+ symbol: "CYD",
55
+ tokenAddress: chainData.yieldAddress,
56
+ transferTime: {},
57
+ txCostAmount: { maxAmount: "0", swap: "0", transfer: "0" },
58
+ yieldAddress: chainData.yieldAddress,
59
+ };
60
+ result.push({
61
+ ...cydDefined,
62
+ yieldAddress: chainData.yieldAddress,
63
+ tokens: tokens,
64
+ });
65
+ }
66
+ }
67
+ });
68
+ return result;
69
+ }
70
+ async getAllowance(params, provider) {
71
+ return await this.tokenService.getAllowance({ ...params, spender: params.token.yieldAddress }, provider);
72
+ }
73
+ async checkAllowance(params, provider) {
74
+ return this.tokenService.checkAllowance({ ...params, spender: params.token.yieldAddress }, provider);
75
+ }
76
+ async balanceOf(params, provider) {
77
+ return getChainYieldService(params.token.chainSymbol, this.api, this.nodeRpcUrlsConfig, params.owner, provider).balanceOf(params);
78
+ }
79
+ async getEstimatedAmountOnDeposit(params, provider) {
80
+ (0, utils_1.validateAmountGtZero)(params.amount);
81
+ (0, utils_1.validateAmountDecimals)("amount", params.amount, params.token.decimals);
82
+ return getChainYieldService(params.token.chainSymbol, this.api, this.nodeRpcUrlsConfig, params.token.yieldAddress, provider).getEstimatedAmountOnDeposit(params);
83
+ }
84
+ async getWithdrawAmounts(params, provider) {
85
+ (0, utils_1.validateAmountGtZero)(params.amount);
86
+ (0, utils_1.validateAmountDecimals)("amount", params.amount, constants_1.SYSTEM_PRECISION);
87
+ const proportionAmounts = await getChainYieldService(params.cydToken.chainSymbol, this.api, this.nodeRpcUrlsConfig, params.owner, provider).getWithdrawProportionAmount(params);
88
+ return params.cydToken.tokens
89
+ .filter((token) => proportionAmounts[token.yieldId] !== undefined)
90
+ .map((token) => ({
91
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
92
+ amount: (0, calculation_1.convertIntAmountToFloat)(proportionAmounts[token.yieldId], token.decimals).toFixed(),
93
+ token: token,
94
+ }));
95
+ }
96
+ }
97
+ exports.DefaultYieldService = DefaultYieldService;
98
+ function getChainYieldService(chainSymbol, api, nodeRpcUrlsConfig, ownerAddress, provider) {
99
+ switch (chains_1.Chains.getChainProperty(chainSymbol).chainType) {
100
+ case index_1.ChainType.EVM: {
101
+ if (provider) {
102
+ return new evm_1.EvmYieldService(provider, api);
103
+ }
104
+ else {
105
+ const nodeRpcUrl = nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);
106
+ const web3 = new web3_1.Web3(nodeRpcUrl);
107
+ web3.defaultReturnFormat = { number: web3_1.FMT_NUMBER.STR, bytes: web3_1.FMT_BYTES.HEX };
108
+ return new evm_1.EvmYieldService(web3, api);
109
+ }
110
+ }
111
+ case index_1.ChainType.TRX: {
112
+ if (provider) {
113
+ return new trx_1.TronYieldService(provider, api);
114
+ }
115
+ else {
116
+ const nodeRpcUrl = nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);
117
+ const tronWeb = new tronweb_1.TronWeb({ fullHost: nodeRpcUrl });
118
+ tronWeb.setAddress(ownerAddress);
119
+ return new trx_1.TronYieldService(tronWeb, api);
120
+ }
121
+ }
122
+ case index_1.ChainType.SOLANA: {
123
+ throw new exceptions_1.MethodNotSupportedError();
124
+ }
125
+ case index_1.ChainType.SRB: {
126
+ throw new exceptions_1.MethodNotSupportedError();
127
+ }
128
+ case index_1.ChainType.SUI: {
129
+ throw new exceptions_1.MethodNotSupportedError();
130
+ }
131
+ }
132
+ }
133
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/yield/index.ts"],"names":[],"mappings":";;;AAgMA,oDAsCC;AAtOD,qCAAkC;AAClC,+BAAmD;AACnD,yCAAsC;AAGtC,iDAA2D;AAC3D,uCAAuG;AACvG,yDAAkE;AAClE,iEAAqE;AACrE,6CAAiF;AAIjF,+BAAwC;AAYxC,mFAAgH;AAChH,+BAAyC;AACzC,+CAAiD;AAsDjD,MAAa,mBAAmB;IAIpB;IACA;IACA;IACA;IANH,YAAY,CAA6B;IAEhD,YACU,GAAgC,EAChC,iBAAoC,EACpC,MAA+B,EAC/B,YAA0B;QAH1B,QAAG,GAAH,GAAG,CAA6B;QAChC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,WAAM,GAAN,MAAM,CAAyB;QAC/B,iBAAY,GAAZ,YAAY,CAAc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,CAAC,CAAC;YACnB,MAAM,IAAI,oCAAuB,EAAE,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { TronWeb } from \"tronweb\";\nimport { FMT_BYTES, FMT_NUMBER, Web3 } from \"web3\";\nimport { Chains } from \"../../chains\";\nimport { AllbridgeCoreClient } from \"../../client/core-api/core-client-base\";\nimport { AllbridgeCoreClientFiltered } from \"../../client/core-api/core-client-filtered\";\nimport { MethodNotSupportedError } from \"../../exceptions\";\nimport { AllbridgeCoreSdkOptions, ChainType, EssentialWeb3, TokenWithChainDetails } from \"../../index\";\nimport { convertIntAmountToFloat } from \"../../utils/calculation\";\nimport { SYSTEM_PRECISION } from \"../../utils/calculation/constants\";\nimport { validateAmountDecimals, validateAmountGtZero } from \"../../utils/utils\";\nimport { NodeRpcUrlsConfig } from \"../index\";\nimport { Provider } from \"../models\";\nimport { TokenService } from \"../token\";\nimport { EvmYieldService } from \"./evm\";\nimport {\n ChainYieldService,\n CYDToken,\n TokenWithChainDetailsYield,\n YieldBalanceParams,\n YieldCheckAllowanceParams,\n YieldGetAllowanceParams,\n YieldGetEstimatedAmountOnDepositParams,\n YieldGetWithdrawProportionAmountParams,\n YieldWithdrawAmount,\n} from \"./models\";\nimport { DefaultRawYieldTransactionBuilder, RawYieldTransactionBuilder } from \"./raw-yield-transaction-builder\";\nimport { TronYieldService } from \"./trx\";\nimport { isYieldSupported } from \"./validations\";\n\nexport interface YieldService {\n rawTxBuilder: RawYieldTransactionBuilder;\n\n /**\n * Returns a list of supported {@link CYDToken}.\n */\n getCYDTokens(): Promise<CYDToken[]>;\n\n /**\n * Get amount of tokens approved for Yield\n * @param provider - will be used to access the network\n * @param params See {@link YieldGetAllowanceParams}\n * @returns the amount of approved tokens\n */\n getAllowance(params: YieldGetAllowanceParams, provider?: Provider): Promise<string>;\n\n /**\n * Check if the amount of approved tokens is enough\n * @param params See {@link YieldCheckAllowanceParams}\n * @param provider - will be used to access the network\n * @returns true if the amount of approved tokens is enough to make a transfer\n */\n checkAllowance(params: YieldCheckAllowanceParams, provider?: Provider): Promise<boolean>;\n\n /**\n * Get token balance\n * @param params\n * @param provider\n * @returns Token balance\n */\n balanceOf(params: YieldBalanceParams, provider?: Provider): Promise<string>;\n\n /**\n * Calculates the amount of CYD tokens that will be deposited\n * @param params - will be used to access the network\n * @param provider - will be used to access the network\n * @returns amount\n */\n getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams, provider?: Provider): Promise<string>;\n\n /**\n * Calculates the amounts of tokens ({@link YieldWithdrawAmount}) will be withdrawn\n * @param params\n * @param provider - will be used to access the network\n * @returns amounts\n */\n getWithdrawAmounts(\n params: YieldGetWithdrawProportionAmountParams,\n provider?: Provider\n ): Promise<YieldWithdrawAmount[]>;\n}\n\nexport class DefaultYieldService implements YieldService {\n public rawTxBuilder: RawYieldTransactionBuilder;\n\n constructor(\n private api: AllbridgeCoreClientFiltered,\n private nodeRpcUrlsConfig: NodeRpcUrlsConfig,\n private params: AllbridgeCoreSdkOptions,\n private tokenService: TokenService\n ) {\n this.rawTxBuilder = new DefaultRawYieldTransactionBuilder(api, nodeRpcUrlsConfig, params, tokenService);\n }\n\n async getCYDTokens(): Promise<CYDToken[]> {\n const result: CYDToken[] = [];\n const chainMap = await this.api.getChainDetailsMap(\"pool\");\n\n Object.values(chainMap).forEach((chainData) => {\n if (chainData.yieldAddress) {\n const cydToken = chainData.tokens.find((t) => t.tokenAddress === chainData.yieldAddress);\n const tokens: TokenWithChainDetailsYield[] = chainData.tokens.filter(isYieldSupported);\n if (tokens.length > 0) {\n const cydDefined: TokenWithChainDetails = cydToken ?? {\n allbridgeChainId: chainData.allbridgeChainId,\n apr: \"\",\n apr30d: \"\",\n apr7d: \"\",\n bridgeAddress: chainData.bridgeAddress,\n chainId: chainData.chainId,\n chainName: chainData.name,\n chainSymbol: chainData.chainSymbol,\n chainType: chainData.chainType,\n confirmations: chainData.confirmations,\n decimals: 3,\n feeShare: \"\",\n lpRate: \"\",\n name: \"Core Yield\",\n poolAddress: \"\",\n symbol: \"CYD\",\n tokenAddress: chainData.yieldAddress,\n transferTime: {},\n txCostAmount: { maxAmount: \"0\", swap: \"0\", transfer: \"0\" },\n yieldAddress: chainData.yieldAddress,\n };\n result.push({\n ...cydDefined,\n yieldAddress: chainData.yieldAddress,\n tokens: tokens,\n });\n }\n }\n });\n\n return result;\n }\n\n async getAllowance(params: YieldGetAllowanceParams, provider?: Provider): Promise<string> {\n return await this.tokenService.getAllowance({ ...params, spender: params.token.yieldAddress }, provider);\n }\n\n async checkAllowance(params: YieldCheckAllowanceParams, provider?: Provider): Promise<boolean> {\n return this.tokenService.checkAllowance({ ...params, spender: params.token.yieldAddress }, provider);\n }\n\n async balanceOf(params: YieldBalanceParams, provider?: Provider): Promise<string> {\n return getChainYieldService(\n params.token.chainSymbol,\n this.api,\n this.nodeRpcUrlsConfig,\n params.owner,\n provider\n ).balanceOf(params);\n }\n\n async getEstimatedAmountOnDeposit(\n params: YieldGetEstimatedAmountOnDepositParams,\n provider?: Provider\n ): Promise<string> {\n validateAmountGtZero(params.amount);\n validateAmountDecimals(\"amount\", params.amount, params.token.decimals);\n return getChainYieldService(\n params.token.chainSymbol,\n this.api,\n this.nodeRpcUrlsConfig,\n params.token.yieldAddress,\n provider\n ).getEstimatedAmountOnDeposit(params);\n }\n\n async getWithdrawAmounts(\n params: YieldGetWithdrawProportionAmountParams,\n provider?: Provider\n ): Promise<YieldWithdrawAmount[]> {\n validateAmountGtZero(params.amount);\n validateAmountDecimals(\"amount\", params.amount, SYSTEM_PRECISION);\n const proportionAmounts = await getChainYieldService(\n params.cydToken.chainSymbol,\n this.api,\n this.nodeRpcUrlsConfig,\n params.owner,\n provider\n ).getWithdrawProportionAmount(params);\n return params.cydToken.tokens\n .filter((token) => proportionAmounts[token.yieldId] !== undefined)\n .map((token) => ({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n amount: convertIntAmountToFloat(proportionAmounts[token.yieldId]!, token.decimals).toFixed(),\n token: token,\n }));\n }\n}\n\nexport function getChainYieldService(\n chainSymbol: string,\n api: AllbridgeCoreClient,\n nodeRpcUrlsConfig: NodeRpcUrlsConfig,\n ownerAddress: string,\n provider?: Provider\n): ChainYieldService {\n switch (Chains.getChainProperty(chainSymbol).chainType) {\n case ChainType.EVM: {\n if (provider) {\n return new EvmYieldService(provider as EssentialWeb3, api);\n } else {\n const nodeRpcUrl = nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);\n const web3 = new Web3(nodeRpcUrl);\n web3.defaultReturnFormat = { number: FMT_NUMBER.STR, bytes: FMT_BYTES.HEX };\n return new EvmYieldService(web3, api);\n }\n }\n case ChainType.TRX: {\n if (provider) {\n return new TronYieldService(provider as TronWeb, api);\n } else {\n const nodeRpcUrl = nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);\n const tronWeb = new TronWeb({ fullHost: nodeRpcUrl });\n tronWeb.setAddress(ownerAddress);\n return new TronYieldService(tronWeb, api);\n }\n }\n case ChainType.SOLANA: {\n throw new MethodNotSupportedError();\n }\n case ChainType.SRB: {\n throw new MethodNotSupportedError();\n }\n case ChainType.SUI: {\n throw new MethodNotSupportedError();\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./yield.model";
2
+ export { ChainYieldService } from "./yield";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ChainYieldService = void 0;
18
+ __exportStar(require("./yield.model"), exports);
19
+ var yield_1 = require("./yield");
20
+ Object.defineProperty(exports, "ChainYieldService", { enumerable: true, get: function () { return yield_1.ChainYieldService; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/yield/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA","sourcesContent":["export * from \"./yield.model\";\nexport { ChainYieldService } from \"./yield\";\n"]}
@@ -0,0 +1,13 @@
1
+ import { ChainType } from "../../../chains/chain.enums";
2
+ import { AllbridgeCoreClient } from "../../../client/core-api/core-client-base";
3
+ import { RawTransaction } from "../../models";
4
+ import { YieldBalanceParams, YieldDepositParams, YieldGetEstimatedAmountOnDepositParams, YieldGetWithdrawProportionAmountParams, YieldWithdrawParams } from "./yield.model";
5
+ export declare abstract class ChainYieldService {
6
+ abstract chainType: ChainType;
7
+ abstract api: AllbridgeCoreClient;
8
+ abstract balanceOf(params: YieldBalanceParams): Promise<string>;
9
+ abstract getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams): Promise<string>;
10
+ abstract getWithdrawProportionAmount(params: YieldGetWithdrawProportionAmountParams): Promise<string[]>;
11
+ abstract buildRawTransactionDeposit(params: YieldDepositParams): Promise<RawTransaction>;
12
+ abstract buildRawTransactionWithdraw(params: YieldWithdrawParams): Promise<RawTransaction>;
13
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChainYieldService = void 0;
4
+ class ChainYieldService {
5
+ }
6
+ exports.ChainYieldService = ChainYieldService;
7
+ //# sourceMappingURL=yield.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yield.js","sourceRoot":"","sources":["../../../../../src/services/yield/models/yield.ts"],"names":[],"mappings":";;;AAWA,MAAsB,iBAAiB;CAatC;AAbD,8CAaC","sourcesContent":["import { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { RawTransaction } from \"../../models\";\nimport {\n YieldBalanceParams,\n YieldDepositParams,\n YieldGetEstimatedAmountOnDepositParams,\n YieldGetWithdrawProportionAmountParams,\n YieldWithdrawParams,\n} from \"./yield.model\";\n\nexport abstract class ChainYieldService {\n abstract chainType: ChainType;\n abstract api: AllbridgeCoreClient;\n\n abstract balanceOf(params: YieldBalanceParams): Promise<string>;\n\n abstract getEstimatedAmountOnDeposit(params: YieldGetEstimatedAmountOnDepositParams): Promise<string>;\n\n abstract getWithdrawProportionAmount(params: YieldGetWithdrawProportionAmountParams): Promise<string[]>;\n\n abstract buildRawTransactionDeposit(params: YieldDepositParams): Promise<RawTransaction>;\n\n abstract buildRawTransactionWithdraw(params: YieldWithdrawParams): Promise<RawTransaction>;\n}\n"]}
@@ -0,0 +1,94 @@
1
+ import { Big } from "big.js";
2
+ import { TokenWithChainDetails } from "../../../tokens-info";
3
+ export type TokenWithChainDetailsYield = TokenWithChainDetails & {
4
+ yieldAddress: string;
5
+ yieldId: string;
6
+ };
7
+ export interface CYDToken extends TokenWithChainDetails {
8
+ yieldAddress: string;
9
+ tokens: TokenWithChainDetailsYield[];
10
+ }
11
+ export interface YieldGetAllowanceParams {
12
+ token: TokenWithChainDetailsYield;
13
+ owner: string;
14
+ }
15
+ export interface YieldCheckAllowanceParams extends YieldGetAllowanceParams {
16
+ /**
17
+ * The float amount of tokens to check the allowance.
18
+ */
19
+ amount: string | number | Big;
20
+ }
21
+ export interface YieldBalanceParams {
22
+ owner: string;
23
+ token: Pick<CYDToken, "chainSymbol" | "yieldAddress">;
24
+ }
25
+ export interface YieldGetEstimatedAmountOnDepositParams {
26
+ /**
27
+ * The float amount of tokens to deposit.
28
+ */
29
+ amount: string;
30
+ token: TokenWithChainDetailsYield;
31
+ }
32
+ export interface YieldGetWithdrawProportionAmountParams {
33
+ /**
34
+ * The float amount of tokens to withdraw.
35
+ */
36
+ amount: string;
37
+ owner: string;
38
+ cydToken: Pick<CYDToken, "chainSymbol" | "yieldAddress" | "tokens">;
39
+ }
40
+ export interface YieldWithdrawAmount {
41
+ /**
42
+ * The float amount of tokens to be withdrawn.
43
+ */
44
+ amount: string;
45
+ token: TokenWithChainDetailsYield;
46
+ }
47
+ export interface YieldApproveParams {
48
+ /**
49
+ * The token info
50
+ */
51
+ token: TokenWithChainDetailsYield;
52
+ /**
53
+ * The address of the token owner who is granting permission to use tokens
54
+ */
55
+ owner: string;
56
+ /**
57
+ * The integer amount of tokens to approve.
58
+ * Optional.
59
+ * The maximum amount by default.
60
+ */
61
+ amount?: string | number | Big;
62
+ }
63
+ export interface YieldDepositParams {
64
+ /**
65
+ * The account address to operate tokens with.
66
+ */
67
+ owner: string;
68
+ /**
69
+ * {@link TokenWithChainDetailsYield} operation token.
70
+ */
71
+ token: TokenWithChainDetailsYield;
72
+ /**
73
+ * The float amount of tokens.
74
+ */
75
+ amount: string;
76
+ /**
77
+ * The Minimum float amount of CYD tokens.
78
+ */
79
+ minVirtualAmount: string;
80
+ }
81
+ export interface YieldWithdrawParams {
82
+ /**
83
+ * The account address to operate tokens with.
84
+ */
85
+ owner: string;
86
+ /**
87
+ * {@link TokenWithChainDetailsYield} operation token.
88
+ */
89
+ token: CYDToken;
90
+ /**
91
+ * The float amount of tokens.
92
+ */
93
+ amount: string;
94
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=yield.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yield.model.js","sourceRoot":"","sources":["../../../../../src/services/yield/models/yield.model.ts"],"names":[],"mappings":"","sourcesContent":["import { Big } from \"big.js\";\nimport { TokenWithChainDetails } from \"../../../tokens-info\";\n\nexport type TokenWithChainDetailsYield = TokenWithChainDetails & {\n yieldAddress: string;\n yieldId: string;\n};\n\nexport interface CYDToken extends TokenWithChainDetails {\n yieldAddress: string;\n tokens: TokenWithChainDetailsYield[];\n}\n\nexport interface YieldGetAllowanceParams {\n token: TokenWithChainDetailsYield;\n owner: string;\n}\n\nexport interface YieldCheckAllowanceParams extends YieldGetAllowanceParams {\n /**\n * The float amount of tokens to check the allowance.\n */\n amount: string | number | Big;\n}\n\nexport interface YieldBalanceParams {\n owner: string;\n token: Pick<CYDToken, \"chainSymbol\" | \"yieldAddress\">;\n}\n\nexport interface YieldGetEstimatedAmountOnDepositParams {\n /**\n * The float amount of tokens to deposit.\n */\n amount: string;\n token: TokenWithChainDetailsYield;\n}\n\nexport interface YieldGetWithdrawProportionAmountParams {\n /**\n * The float amount of tokens to withdraw.\n */\n amount: string;\n owner: string;\n cydToken: Pick<CYDToken, \"chainSymbol\" | \"yieldAddress\" | \"tokens\">;\n}\n\nexport interface YieldWithdrawAmount {\n /**\n * The float amount of tokens to be withdrawn.\n */\n amount: string;\n token: TokenWithChainDetailsYield;\n}\n\nexport interface YieldApproveParams {\n /**\n * The token info\n */\n token: TokenWithChainDetailsYield;\n\n /**\n * The address of the token owner who is granting permission to use tokens\n */\n owner: string;\n\n /**\n * The integer amount of tokens to approve.\n * Optional.\n * The maximum amount by default.\n */\n amount?: string | number | Big;\n}\n\nexport interface YieldDepositParams {\n /**\n * The account address to operate tokens with.\n */\n owner: string;\n /**\n * {@link TokenWithChainDetailsYield} operation token.\n */\n token: TokenWithChainDetailsYield;\n\n /**\n * The float amount of tokens.\n */\n amount: string;\n /**\n * The Minimum float amount of CYD tokens.\n */\n minVirtualAmount: string;\n}\n\nexport interface YieldWithdrawParams {\n /**\n * The account address to operate tokens with.\n */\n owner: string;\n /**\n * {@link TokenWithChainDetailsYield} operation token.\n */\n token: CYDToken;\n\n /**\n * The float amount of tokens.\n */\n amount: string;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { NodeRpcUrlsConfig } from "..";
2
+ import { AllbridgeCoreClient } from "../../client/core-api/core-client-base";
3
+ import { AllbridgeCoreSdkOptions } from "../../index";
4
+ import { Provider, RawTransaction } from "../models";
5
+ import { TokenService } from "../token";
6
+ import { YieldApproveParams, YieldDepositParams, YieldWithdrawParams } from "./models/yield.model";
7
+ export interface RawYieldTransactionBuilder {
8
+ /**
9
+ * Creates a Raw Transaction for approving tokens usage by the Yield
10
+ * @param approveData
11
+ * @param provider - will be used to access the network
12
+ */
13
+ approve(approveData: YieldApproveParams, provider?: Provider): Promise<RawTransaction>;
14
+ /**
15
+ * Creates a Raw Transaction for depositing tokens to Yield
16
+ * @param params
17
+ * @param provider - will be used to access the network
18
+ */
19
+ deposit(params: YieldDepositParams, provider?: Provider): Promise<RawTransaction>;
20
+ /**
21
+ * Creates a Raw Transaction for withdrawing tokens from Yield
22
+ * @param params
23
+ * @param provider - will be used to access the network
24
+ */
25
+ withdraw(params: YieldWithdrawParams, provider?: Provider): Promise<RawTransaction>;
26
+ }
27
+ export declare class DefaultRawYieldTransactionBuilder implements RawYieldTransactionBuilder {
28
+ private api;
29
+ private nodeRpcUrlsConfig;
30
+ private params;
31
+ private tokenService;
32
+ constructor(api: AllbridgeCoreClient, nodeRpcUrlsConfig: NodeRpcUrlsConfig, params: AllbridgeCoreSdkOptions, tokenService: TokenService);
33
+ approve(approveData: YieldApproveParams, provider?: Provider): Promise<RawTransaction>;
34
+ deposit(params: YieldDepositParams, provider?: Provider): Promise<RawTransaction>;
35
+ withdraw(params: YieldWithdrawParams, provider?: Provider): Promise<RawTransaction>;
36
+ }