@compass-labs/api-sdk 2.2.19 → 2.2.20-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/codeSamples_typescript.yaml +36 -0
- package/dist/commonjs/funcs/creditCreditBorrow.d.ts +25 -0
- package/dist/commonjs/funcs/creditCreditBorrow.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditBorrow.js +125 -0
- package/dist/commonjs/funcs/creditCreditBorrow.js.map +1 -0
- package/dist/commonjs/funcs/creditCreditBundle.d.ts +21 -0
- package/dist/commonjs/funcs/creditCreditBundle.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditBundle.js +121 -0
- package/dist/commonjs/funcs/creditCreditBundle.js.map +1 -0
- package/dist/commonjs/funcs/creditCreditCreateAccount.d.ts +26 -0
- package/dist/commonjs/funcs/creditCreditCreateAccount.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditCreateAccount.js +126 -0
- package/dist/commonjs/funcs/creditCreditCreateAccount.js.map +1 -0
- package/dist/commonjs/funcs/creditCreditPositions.d.ts +22 -0
- package/dist/commonjs/funcs/creditCreditPositions.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditPositions.js +126 -0
- package/dist/commonjs/funcs/creditCreditPositions.js.map +1 -0
- package/dist/commonjs/funcs/creditCreditRepay.d.ts +26 -0
- package/dist/commonjs/funcs/creditCreditRepay.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditRepay.js +126 -0
- package/dist/commonjs/funcs/creditCreditRepay.js.map +1 -0
- package/dist/commonjs/funcs/creditCreditTransfer.d.ts +27 -0
- package/dist/commonjs/funcs/creditCreditTransfer.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditTransfer.js +127 -0
- package/dist/commonjs/funcs/creditCreditTransfer.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/accountsummary.d.ts +40 -0
- package/dist/commonjs/models/components/accountsummary.d.ts.map +1 -0
- package/dist/commonjs/models/components/accountsummary.js +66 -0
- package/dist/commonjs/models/components/accountsummary.js.map +1 -0
- package/dist/commonjs/models/components/borrowabletoken.d.ts +28 -0
- package/dist/commonjs/models/components/borrowabletoken.d.ts.map +1 -0
- package/dist/commonjs/models/components/borrowabletoken.js +59 -0
- package/dist/commonjs/models/components/borrowabletoken.js.map +1 -0
- package/dist/commonjs/models/components/collateralposition.d.ts +53 -0
- package/dist/commonjs/models/components/collateralposition.d.ts.map +1 -0
- package/dist/commonjs/models/components/collateralposition.js +71 -0
- package/dist/commonjs/models/components/collateralposition.js.map +1 -0
- package/dist/commonjs/models/components/createcreditaccountrequest.d.ts +39 -0
- package/dist/commonjs/models/components/createcreditaccountrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/createcreditaccountrequest.js +64 -0
- package/dist/commonjs/models/components/createcreditaccountrequest.js.map +1 -0
- package/dist/commonjs/models/components/createcreditaccountresponse.d.ts +21 -0
- package/dist/commonjs/models/components/createcreditaccountresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/createcreditaccountresponse.js +57 -0
- package/dist/commonjs/models/components/createcreditaccountresponse.js.map +1 -0
- package/dist/commonjs/models/components/creditborrowparams.d.ts +44 -0
- package/dist/commonjs/models/components/creditborrowparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditborrowparams.js +65 -0
- package/dist/commonjs/models/components/creditborrowparams.js.map +1 -0
- package/dist/commonjs/models/components/creditborrowrequest.d.ts +108 -0
- package/dist/commonjs/models/components/creditborrowrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditborrowrequest.js +95 -0
- package/dist/commonjs/models/components/creditborrowrequest.js.map +1 -0
- package/dist/commonjs/models/components/creditborrowresponse.d.ts +23 -0
- package/dist/commonjs/models/components/creditborrowresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditborrowresponse.js +61 -0
- package/dist/commonjs/models/components/creditborrowresponse.js.map +1 -0
- package/dist/commonjs/models/components/creditbundlerequest.d.ts +35 -0
- package/dist/commonjs/models/components/creditbundlerequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditbundlerequest.js +59 -0
- package/dist/commonjs/models/components/creditbundlerequest.js.map +1 -0
- package/dist/commonjs/models/components/creditbundleresponse.d.ts +23 -0
- package/dist/commonjs/models/components/creditbundleresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditbundleresponse.js +61 -0
- package/dist/commonjs/models/components/creditbundleresponse.js.map +1 -0
- package/dist/commonjs/models/components/creditevent.d.ts +53 -0
- package/dist/commonjs/models/components/creditevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditevent.js +76 -0
- package/dist/commonjs/models/components/creditevent.js.map +1 -0
- package/dist/commonjs/models/components/creditpositionsresponse.d.ts +36 -0
- package/dist/commonjs/models/components/creditpositionsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditpositionsresponse.js +67 -0
- package/dist/commonjs/models/components/creditpositionsresponse.js.map +1 -0
- package/dist/commonjs/models/components/creditrepayparams.d.ts +44 -0
- package/dist/commonjs/models/components/creditrepayparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditrepayparams.js +65 -0
- package/dist/commonjs/models/components/creditrepayparams.js.map +1 -0
- package/dist/commonjs/models/components/creditrepayrequest.d.ts +108 -0
- package/dist/commonjs/models/components/creditrepayrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditrepayrequest.js +95 -0
- package/dist/commonjs/models/components/creditrepayrequest.js.map +1 -0
- package/dist/commonjs/models/components/creditrepayresponse.d.ts +23 -0
- package/dist/commonjs/models/components/creditrepayresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditrepayresponse.js +61 -0
- package/dist/commonjs/models/components/creditrepayresponse.js.map +1 -0
- package/dist/commonjs/models/components/creditsupplyparams.d.ts +34 -0
- package/dist/commonjs/models/components/creditsupplyparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditsupplyparams.js +62 -0
- package/dist/commonjs/models/components/creditsupplyparams.js.map +1 -0
- package/dist/commonjs/models/components/credittransferrequest.d.ts +40 -0
- package/dist/commonjs/models/components/credittransferrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/credittransferrequest.js +59 -0
- package/dist/commonjs/models/components/credittransferrequest.js.map +1 -0
- package/dist/commonjs/models/components/credittransferresponse.d.ts +11 -0
- package/dist/commonjs/models/components/credittransferresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/credittransferresponse.js +56 -0
- package/dist/commonjs/models/components/credittransferresponse.js.map +1 -0
- package/dist/commonjs/models/components/credituseroperation.d.ts +28 -0
- package/dist/commonjs/models/components/credituseroperation.d.ts.map +1 -0
- package/dist/commonjs/models/components/credituseroperation.js +78 -0
- package/dist/commonjs/models/components/credituseroperation.js.map +1 -0
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts +34 -0
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditwithdrawparams.js +62 -0
- package/dist/commonjs/models/components/creditwithdrawparams.js.map +1 -0
- package/dist/commonjs/models/components/debtposition.d.ts +49 -0
- package/dist/commonjs/models/components/debtposition.d.ts.map +1 -0
- package/dist/commonjs/models/components/debtposition.js +69 -0
- package/dist/commonjs/models/components/debtposition.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +21 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +21 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/v2creditpositions.d.ts +26 -0
- package/dist/commonjs/models/operations/v2creditpositions.d.ts.map +1 -0
- package/dist/commonjs/models/operations/v2creditpositions.js +57 -0
- package/dist/commonjs/models/operations/v2creditpositions.js.map +1 -0
- package/dist/commonjs/sdk/credit.d.ts +86 -0
- package/dist/commonjs/sdk/credit.d.ts.map +1 -0
- package/dist/commonjs/sdk/credit.js +110 -0
- package/dist/commonjs/sdk/credit.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/creditCreditBorrow.d.ts +25 -0
- package/dist/esm/funcs/creditCreditBorrow.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditBorrow.js +89 -0
- package/dist/esm/funcs/creditCreditBorrow.js.map +1 -0
- package/dist/esm/funcs/creditCreditBundle.d.ts +21 -0
- package/dist/esm/funcs/creditCreditBundle.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditBundle.js +85 -0
- package/dist/esm/funcs/creditCreditBundle.js.map +1 -0
- package/dist/esm/funcs/creditCreditCreateAccount.d.ts +26 -0
- package/dist/esm/funcs/creditCreditCreateAccount.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditCreateAccount.js +90 -0
- package/dist/esm/funcs/creditCreditCreateAccount.js.map +1 -0
- package/dist/esm/funcs/creditCreditPositions.d.ts +22 -0
- package/dist/esm/funcs/creditCreditPositions.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditPositions.js +90 -0
- package/dist/esm/funcs/creditCreditPositions.js.map +1 -0
- package/dist/esm/funcs/creditCreditRepay.d.ts +26 -0
- package/dist/esm/funcs/creditCreditRepay.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditRepay.js +90 -0
- package/dist/esm/funcs/creditCreditRepay.js.map +1 -0
- package/dist/esm/funcs/creditCreditTransfer.d.ts +27 -0
- package/dist/esm/funcs/creditCreditTransfer.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditTransfer.js +91 -0
- package/dist/esm/funcs/creditCreditTransfer.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/accountsummary.d.ts +40 -0
- package/dist/esm/models/components/accountsummary.d.ts.map +1 -0
- package/dist/esm/models/components/accountsummary.js +29 -0
- package/dist/esm/models/components/accountsummary.js.map +1 -0
- package/dist/esm/models/components/borrowabletoken.d.ts +28 -0
- package/dist/esm/models/components/borrowabletoken.d.ts.map +1 -0
- package/dist/esm/models/components/borrowabletoken.js +22 -0
- package/dist/esm/models/components/borrowabletoken.js.map +1 -0
- package/dist/esm/models/components/collateralposition.d.ts +53 -0
- package/dist/esm/models/components/collateralposition.d.ts.map +1 -0
- package/dist/esm/models/components/collateralposition.js +34 -0
- package/dist/esm/models/components/collateralposition.js.map +1 -0
- package/dist/esm/models/components/createcreditaccountrequest.d.ts +39 -0
- package/dist/esm/models/components/createcreditaccountrequest.d.ts.map +1 -0
- package/dist/esm/models/components/createcreditaccountrequest.js +27 -0
- package/dist/esm/models/components/createcreditaccountrequest.js.map +1 -0
- package/dist/esm/models/components/createcreditaccountresponse.d.ts +21 -0
- package/dist/esm/models/components/createcreditaccountresponse.d.ts.map +1 -0
- package/dist/esm/models/components/createcreditaccountresponse.js +20 -0
- package/dist/esm/models/components/createcreditaccountresponse.js.map +1 -0
- package/dist/esm/models/components/creditborrowparams.d.ts +44 -0
- package/dist/esm/models/components/creditborrowparams.d.ts.map +1 -0
- package/dist/esm/models/components/creditborrowparams.js +27 -0
- package/dist/esm/models/components/creditborrowparams.js.map +1 -0
- package/dist/esm/models/components/creditborrowrequest.d.ts +108 -0
- package/dist/esm/models/components/creditborrowrequest.d.ts.map +1 -0
- package/dist/esm/models/components/creditborrowrequest.js +55 -0
- package/dist/esm/models/components/creditborrowrequest.js.map +1 -0
- package/dist/esm/models/components/creditborrowresponse.d.ts +23 -0
- package/dist/esm/models/components/creditborrowresponse.d.ts.map +1 -0
- package/dist/esm/models/components/creditborrowresponse.js +24 -0
- package/dist/esm/models/components/creditborrowresponse.js.map +1 -0
- package/dist/esm/models/components/creditbundlerequest.d.ts +35 -0
- package/dist/esm/models/components/creditbundlerequest.d.ts.map +1 -0
- package/dist/esm/models/components/creditbundlerequest.js +22 -0
- package/dist/esm/models/components/creditbundlerequest.js.map +1 -0
- package/dist/esm/models/components/creditbundleresponse.d.ts +23 -0
- package/dist/esm/models/components/creditbundleresponse.d.ts.map +1 -0
- package/dist/esm/models/components/creditbundleresponse.js +24 -0
- package/dist/esm/models/components/creditbundleresponse.js.map +1 -0
- package/dist/esm/models/components/creditevent.d.ts +53 -0
- package/dist/esm/models/components/creditevent.d.ts.map +1 -0
- package/dist/esm/models/components/creditevent.js +39 -0
- package/dist/esm/models/components/creditevent.js.map +1 -0
- package/dist/esm/models/components/creditpositionsresponse.d.ts +36 -0
- package/dist/esm/models/components/creditpositionsresponse.d.ts.map +1 -0
- package/dist/esm/models/components/creditpositionsresponse.js +30 -0
- package/dist/esm/models/components/creditpositionsresponse.js.map +1 -0
- package/dist/esm/models/components/creditrepayparams.d.ts +44 -0
- package/dist/esm/models/components/creditrepayparams.d.ts.map +1 -0
- package/dist/esm/models/components/creditrepayparams.js +27 -0
- package/dist/esm/models/components/creditrepayparams.js.map +1 -0
- package/dist/esm/models/components/creditrepayrequest.d.ts +108 -0
- package/dist/esm/models/components/creditrepayrequest.d.ts.map +1 -0
- package/dist/esm/models/components/creditrepayrequest.js +55 -0
- package/dist/esm/models/components/creditrepayrequest.js.map +1 -0
- package/dist/esm/models/components/creditrepayresponse.d.ts +23 -0
- package/dist/esm/models/components/creditrepayresponse.d.ts.map +1 -0
- package/dist/esm/models/components/creditrepayresponse.js +24 -0
- package/dist/esm/models/components/creditrepayresponse.js.map +1 -0
- package/dist/esm/models/components/creditsupplyparams.d.ts +34 -0
- package/dist/esm/models/components/creditsupplyparams.d.ts.map +1 -0
- package/dist/esm/models/components/creditsupplyparams.js +24 -0
- package/dist/esm/models/components/creditsupplyparams.js.map +1 -0
- package/dist/esm/models/components/credittransferrequest.d.ts +40 -0
- package/dist/esm/models/components/credittransferrequest.d.ts.map +1 -0
- package/dist/esm/models/components/credittransferrequest.js +21 -0
- package/dist/esm/models/components/credittransferrequest.js.map +1 -0
- package/dist/esm/models/components/credittransferresponse.d.ts +11 -0
- package/dist/esm/models/components/credittransferresponse.d.ts.map +1 -0
- package/dist/esm/models/components/credittransferresponse.js +19 -0
- package/dist/esm/models/components/credittransferresponse.js.map +1 -0
- package/dist/esm/models/components/credituseroperation.d.ts +28 -0
- package/dist/esm/models/components/credituseroperation.d.ts.map +1 -0
- package/dist/esm/models/components/credituseroperation.js +40 -0
- package/dist/esm/models/components/credituseroperation.js.map +1 -0
- package/dist/esm/models/components/creditwithdrawparams.d.ts +34 -0
- package/dist/esm/models/components/creditwithdrawparams.d.ts.map +1 -0
- package/dist/esm/models/components/creditwithdrawparams.js +24 -0
- package/dist/esm/models/components/creditwithdrawparams.js.map +1 -0
- package/dist/esm/models/components/debtposition.d.ts +49 -0
- package/dist/esm/models/components/debtposition.d.ts.map +1 -0
- package/dist/esm/models/components/debtposition.js +32 -0
- package/dist/esm/models/components/debtposition.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +21 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +21 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/v2creditpositions.d.ts +26 -0
- package/dist/esm/models/operations/v2creditpositions.d.ts.map +1 -0
- package/dist/esm/models/operations/v2creditpositions.js +20 -0
- package/dist/esm/models/operations/v2creditpositions.js.map +1 -0
- package/dist/esm/sdk/credit.d.ts +86 -0
- package/dist/esm/sdk/credit.d.ts.map +1 -0
- package/dist/esm/sdk/credit.js +106 -0
- package/dist/esm/sdk/credit.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/docs/models/components/accountsummary.md +30 -0
- package/docs/models/components/borrowabletoken.md +25 -0
- package/docs/models/components/borrowamount.md +19 -0
- package/docs/models/components/collateralposition.md +31 -0
- package/docs/models/components/createcreditaccountrequest.md +24 -0
- package/docs/models/components/createcreditaccountrequestchain.md +15 -0
- package/docs/models/components/createcreditaccountresponse.md +31 -0
- package/docs/models/components/creditborrowparams.md +24 -0
- package/docs/models/components/creditborrowparamsamount.md +19 -0
- package/docs/models/components/creditborrowrequest.md +38 -0
- package/docs/models/components/creditborrowrequestamountin.md +19 -0
- package/docs/models/components/creditborrowrequestslippage.md +19 -0
- package/docs/models/components/creditborrowresponse.md +17 -0
- package/docs/models/components/creditbundlerequest.md +25 -0
- package/docs/models/components/creditbundleresponse.md +19 -0
- package/docs/models/components/creditevent.md +29 -0
- package/docs/models/components/creditpositionsresponse.md +33 -0
- package/docs/models/components/creditrepayparams.md +24 -0
- package/docs/models/components/creditrepayparamsamount.md +19 -0
- package/docs/models/components/creditrepayrequest.md +37 -0
- package/docs/models/components/creditrepayrequestslippage.md +19 -0
- package/docs/models/components/creditrepayresponse.md +17 -0
- package/docs/models/components/creditsupplyparams.md +23 -0
- package/docs/models/components/creditsupplyparamsamount.md +19 -0
- package/docs/models/components/credittransferrequest.md +23 -0
- package/docs/models/components/credittransferrequestamount.md +19 -0
- package/docs/models/components/credittransferresponse.md +75 -0
- package/docs/models/components/credituseroperation.md +23 -0
- package/docs/models/components/credituseroperationbody.md +80 -0
- package/docs/models/components/creditwithdrawparams.md +23 -0
- package/docs/models/components/creditwithdrawparamsamount.md +19 -0
- package/docs/models/components/debtposition.md +30 -0
- package/docs/models/components/eventtype.md +17 -0
- package/docs/models/components/repayamount.md +19 -0
- package/docs/models/components/withdrawamount.md +19 -0
- package/docs/models/operations/v2creditpositionschain.md +15 -0
- package/docs/models/operations/v2creditpositionsrequest.md +19 -0
- package/docs/sdks/credit/README.md +562 -0
- package/package.json +1 -1
- package/src/funcs/creditCreditBorrow.ts +176 -0
- package/src/funcs/creditCreditBundle.ts +172 -0
- package/src/funcs/creditCreditCreateAccount.ts +178 -0
- package/src/funcs/creditCreditPositions.ts +178 -0
- package/src/funcs/creditCreditRepay.ts +177 -0
- package/src/funcs/creditCreditTransfer.ts +178 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/accountsummary.ts +77 -0
- package/src/models/components/borrowabletoken.ts +58 -0
- package/src/models/components/collateralposition.ts +94 -0
- package/src/models/components/createcreditaccountrequest.ts +72 -0
- package/src/models/components/createcreditaccountresponse.ts +51 -0
- package/src/models/components/creditborrowparams.ts +89 -0
- package/src/models/components/creditborrowrequest.ts +198 -0
- package/src/models/components/creditborrowresponse.ts +59 -0
- package/src/models/components/creditbundlerequest.ts +66 -0
- package/src/models/components/creditbundleresponse.ts +59 -0
- package/src/models/components/creditevent.ts +92 -0
- package/src/models/components/creditpositionsresponse.ts +79 -0
- package/src/models/components/creditrepayparams.ts +89 -0
- package/src/models/components/creditrepayrequest.ts +190 -0
- package/src/models/components/creditrepayresponse.ts +59 -0
- package/src/models/components/creditsupplyparams.ts +74 -0
- package/src/models/components/credittransferrequest.ts +78 -0
- package/src/models/components/credittransferresponse.ts +40 -0
- package/src/models/components/credituseroperation.ts +133 -0
- package/src/models/components/creditwithdrawparams.ts +74 -0
- package/src/models/components/debtposition.ts +88 -0
- package/src/models/components/index.ts +21 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/v2creditpositions.ts +50 -0
- package/src/sdk/credit.ts +156 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Repay debt and withdraw collateral
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Repay an Aave debt and withdraw collateral from a Credit Account.
|
|
33
|
+
*
|
|
34
|
+
* Bundles repayment, collateral withdrawal, and an optional swap into a single atomic Safe transaction.
|
|
35
|
+
*
|
|
36
|
+
* - If `token_out` is None or equals `withdraw_token`, the withdrawn collateral is kept as-is.
|
|
37
|
+
* - If `token_out` differs from `withdraw_token`, a swap is performed after withdrawal via 1inch.
|
|
38
|
+
*
|
|
39
|
+
* The Credit Account must already have a borrow position created via `/v2/credit/borrow`.
|
|
40
|
+
* The repay_token must be available in the Credit Account (or pulled from EOA via Permit2).
|
|
41
|
+
*/
|
|
42
|
+
export function creditCreditRepay(
|
|
43
|
+
client: CompassApiSDKCore,
|
|
44
|
+
request: components.CreditRepayRequest,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
Result<
|
|
48
|
+
components.CreditRepayResponse,
|
|
49
|
+
| errors.HTTPValidationError
|
|
50
|
+
| CompassAPISDKError
|
|
51
|
+
| ResponseValidationError
|
|
52
|
+
| ConnectionError
|
|
53
|
+
| RequestAbortedError
|
|
54
|
+
| RequestTimeoutError
|
|
55
|
+
| InvalidRequestError
|
|
56
|
+
| UnexpectedClientError
|
|
57
|
+
| SDKValidationError
|
|
58
|
+
>
|
|
59
|
+
> {
|
|
60
|
+
return new APIPromise($do(
|
|
61
|
+
client,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function $do(
|
|
68
|
+
client: CompassApiSDKCore,
|
|
69
|
+
request: components.CreditRepayRequest,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
components.CreditRepayResponse,
|
|
75
|
+
| errors.HTTPValidationError
|
|
76
|
+
| CompassAPISDKError
|
|
77
|
+
| ResponseValidationError
|
|
78
|
+
| ConnectionError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| InvalidRequestError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| SDKValidationError
|
|
84
|
+
>,
|
|
85
|
+
APICall,
|
|
86
|
+
]
|
|
87
|
+
> {
|
|
88
|
+
const parsed = safeParse(
|
|
89
|
+
request,
|
|
90
|
+
(value) => components.CreditRepayRequest$outboundSchema.parse(value),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
98
|
+
|
|
99
|
+
const path = pathToFunc("/v2/credit/repay")();
|
|
100
|
+
|
|
101
|
+
const headers = new Headers(compactMap({
|
|
102
|
+
"Content-Type": "application/json",
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
107
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
108
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
109
|
+
|
|
110
|
+
const context = {
|
|
111
|
+
options: client._options,
|
|
112
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
113
|
+
operationID: "v2_credit_repay",
|
|
114
|
+
oAuth2Scopes: null,
|
|
115
|
+
|
|
116
|
+
resolvedSecurity: requestSecurity,
|
|
117
|
+
|
|
118
|
+
securitySource: client._options.apiKeyAuth,
|
|
119
|
+
retryConfig: options?.retries
|
|
120
|
+
|| client._options.retryConfig
|
|
121
|
+
|| { strategy: "none" },
|
|
122
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const requestRes = client._createRequest(context, {
|
|
126
|
+
security: requestSecurity,
|
|
127
|
+
method: "POST",
|
|
128
|
+
baseURL: options?.serverURL,
|
|
129
|
+
path: path,
|
|
130
|
+
headers: headers,
|
|
131
|
+
body: body,
|
|
132
|
+
userAgent: client._options.userAgent,
|
|
133
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
134
|
+
}, options);
|
|
135
|
+
if (!requestRes.ok) {
|
|
136
|
+
return [requestRes, { status: "invalid" }];
|
|
137
|
+
}
|
|
138
|
+
const req = requestRes.value;
|
|
139
|
+
|
|
140
|
+
const doResult = await client._do(req, {
|
|
141
|
+
context,
|
|
142
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
143
|
+
retryConfig: context.retryConfig,
|
|
144
|
+
retryCodes: context.retryCodes,
|
|
145
|
+
});
|
|
146
|
+
if (!doResult.ok) {
|
|
147
|
+
return [doResult, { status: "request-error", request: req }];
|
|
148
|
+
}
|
|
149
|
+
const response = doResult.value;
|
|
150
|
+
|
|
151
|
+
const responseFields = {
|
|
152
|
+
HttpMeta: { Response: response, Request: req },
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const [result] = await M.match<
|
|
156
|
+
components.CreditRepayResponse,
|
|
157
|
+
| errors.HTTPValidationError
|
|
158
|
+
| CompassAPISDKError
|
|
159
|
+
| ResponseValidationError
|
|
160
|
+
| ConnectionError
|
|
161
|
+
| RequestAbortedError
|
|
162
|
+
| RequestTimeoutError
|
|
163
|
+
| InvalidRequestError
|
|
164
|
+
| UnexpectedClientError
|
|
165
|
+
| SDKValidationError
|
|
166
|
+
>(
|
|
167
|
+
M.json(200, components.CreditRepayResponse$inboundSchema),
|
|
168
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
169
|
+
M.fail("4XX"),
|
|
170
|
+
M.fail("5XX"),
|
|
171
|
+
)(response, req, { extraFields: responseFields });
|
|
172
|
+
if (!result.ok) {
|
|
173
|
+
return [result, { status: "complete", request: req, response }];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return [result, { status: "complete", request: req, response }];
|
|
177
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get Permit2 signature data for Credit Account transfer
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Generate Permit2 EIP-712 typed data for transferring tokens from the owner's EOA
|
|
33
|
+
* to a Credit Account.
|
|
34
|
+
*
|
|
35
|
+
* The owner signs the returned EIP-712 data, then includes the signature in a `/v2/credit/borrow`
|
|
36
|
+
* or `/v2/credit/repay` request to atomically pull tokens from their EOA as part of the bundle.
|
|
37
|
+
*
|
|
38
|
+
* **Flow:**
|
|
39
|
+
* 1. Call this endpoint to get the Permit2 typed data
|
|
40
|
+
* 2. Sign the typed data with the owner's wallet
|
|
41
|
+
* 3. Call `/v2/credit/borrow` or `/v2/credit/repay` with the `permit2_signature`, `permit2_nonce`, and `permit2_deadline` fields
|
|
42
|
+
*/
|
|
43
|
+
export function creditCreditTransfer(
|
|
44
|
+
client: CompassApiSDKCore,
|
|
45
|
+
request: components.CreditTransferRequest,
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): APIPromise<
|
|
48
|
+
Result<
|
|
49
|
+
components.CreditTransferResponse,
|
|
50
|
+
| errors.HTTPValidationError
|
|
51
|
+
| CompassAPISDKError
|
|
52
|
+
| ResponseValidationError
|
|
53
|
+
| ConnectionError
|
|
54
|
+
| RequestAbortedError
|
|
55
|
+
| RequestTimeoutError
|
|
56
|
+
| InvalidRequestError
|
|
57
|
+
| UnexpectedClientError
|
|
58
|
+
| SDKValidationError
|
|
59
|
+
>
|
|
60
|
+
> {
|
|
61
|
+
return new APIPromise($do(
|
|
62
|
+
client,
|
|
63
|
+
request,
|
|
64
|
+
options,
|
|
65
|
+
));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function $do(
|
|
69
|
+
client: CompassApiSDKCore,
|
|
70
|
+
request: components.CreditTransferRequest,
|
|
71
|
+
options?: RequestOptions,
|
|
72
|
+
): Promise<
|
|
73
|
+
[
|
|
74
|
+
Result<
|
|
75
|
+
components.CreditTransferResponse,
|
|
76
|
+
| errors.HTTPValidationError
|
|
77
|
+
| CompassAPISDKError
|
|
78
|
+
| ResponseValidationError
|
|
79
|
+
| ConnectionError
|
|
80
|
+
| RequestAbortedError
|
|
81
|
+
| RequestTimeoutError
|
|
82
|
+
| InvalidRequestError
|
|
83
|
+
| UnexpectedClientError
|
|
84
|
+
| SDKValidationError
|
|
85
|
+
>,
|
|
86
|
+
APICall,
|
|
87
|
+
]
|
|
88
|
+
> {
|
|
89
|
+
const parsed = safeParse(
|
|
90
|
+
request,
|
|
91
|
+
(value) => components.CreditTransferRequest$outboundSchema.parse(value),
|
|
92
|
+
"Input validation failed",
|
|
93
|
+
);
|
|
94
|
+
if (!parsed.ok) {
|
|
95
|
+
return [parsed, { status: "invalid" }];
|
|
96
|
+
}
|
|
97
|
+
const payload = parsed.value;
|
|
98
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
99
|
+
|
|
100
|
+
const path = pathToFunc("/v2/credit/transfer")();
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
103
|
+
"Content-Type": "application/json",
|
|
104
|
+
Accept: "application/json",
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
108
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
109
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
110
|
+
|
|
111
|
+
const context = {
|
|
112
|
+
options: client._options,
|
|
113
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
114
|
+
operationID: "v2_credit_transfer",
|
|
115
|
+
oAuth2Scopes: null,
|
|
116
|
+
|
|
117
|
+
resolvedSecurity: requestSecurity,
|
|
118
|
+
|
|
119
|
+
securitySource: client._options.apiKeyAuth,
|
|
120
|
+
retryConfig: options?.retries
|
|
121
|
+
|| client._options.retryConfig
|
|
122
|
+
|| { strategy: "none" },
|
|
123
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const requestRes = client._createRequest(context, {
|
|
127
|
+
security: requestSecurity,
|
|
128
|
+
method: "POST",
|
|
129
|
+
baseURL: options?.serverURL,
|
|
130
|
+
path: path,
|
|
131
|
+
headers: headers,
|
|
132
|
+
body: body,
|
|
133
|
+
userAgent: client._options.userAgent,
|
|
134
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
135
|
+
}, options);
|
|
136
|
+
if (!requestRes.ok) {
|
|
137
|
+
return [requestRes, { status: "invalid" }];
|
|
138
|
+
}
|
|
139
|
+
const req = requestRes.value;
|
|
140
|
+
|
|
141
|
+
const doResult = await client._do(req, {
|
|
142
|
+
context,
|
|
143
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
144
|
+
retryConfig: context.retryConfig,
|
|
145
|
+
retryCodes: context.retryCodes,
|
|
146
|
+
});
|
|
147
|
+
if (!doResult.ok) {
|
|
148
|
+
return [doResult, { status: "request-error", request: req }];
|
|
149
|
+
}
|
|
150
|
+
const response = doResult.value;
|
|
151
|
+
|
|
152
|
+
const responseFields = {
|
|
153
|
+
HttpMeta: { Response: response, Request: req },
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const [result] = await M.match<
|
|
157
|
+
components.CreditTransferResponse,
|
|
158
|
+
| errors.HTTPValidationError
|
|
159
|
+
| CompassAPISDKError
|
|
160
|
+
| ResponseValidationError
|
|
161
|
+
| ConnectionError
|
|
162
|
+
| RequestAbortedError
|
|
163
|
+
| RequestTimeoutError
|
|
164
|
+
| InvalidRequestError
|
|
165
|
+
| UnexpectedClientError
|
|
166
|
+
| SDKValidationError
|
|
167
|
+
>(
|
|
168
|
+
M.json(200, components.CreditTransferResponse$inboundSchema),
|
|
169
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
170
|
+
M.fail("4XX"),
|
|
171
|
+
M.fail("5XX"),
|
|
172
|
+
)(response, req, { extraFields: responseFields });
|
|
173
|
+
if (!result.ok) {
|
|
174
|
+
return [result, { status: "complete", request: req, response }];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return [result, { status: "complete", request: req, response }];
|
|
178
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
|
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
64
|
sdkVersion: "2.0.0",
|
|
65
|
-
genVersion: "2.
|
|
65
|
+
genVersion: "2.836.5",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.836.5 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Aave account-level summary from getUserAccountData().
|
|
13
|
+
*/
|
|
14
|
+
export type AccountSummary = {
|
|
15
|
+
/**
|
|
16
|
+
* Health factor. Above 1 is safe; below 1 risks liquidation.
|
|
17
|
+
*/
|
|
18
|
+
healthFactor: string;
|
|
19
|
+
/**
|
|
20
|
+
* Total collateral value in USD.
|
|
21
|
+
*/
|
|
22
|
+
totalCollateralUsd: string;
|
|
23
|
+
/**
|
|
24
|
+
* Total debt value in USD.
|
|
25
|
+
*/
|
|
26
|
+
totalDebtUsd: string;
|
|
27
|
+
/**
|
|
28
|
+
* Available borrow capacity in USD.
|
|
29
|
+
*/
|
|
30
|
+
availableBorrowsUsd: string;
|
|
31
|
+
/**
|
|
32
|
+
* Current loan-to-value ratio.
|
|
33
|
+
*/
|
|
34
|
+
ltv: string;
|
|
35
|
+
/**
|
|
36
|
+
* E-Mode category ID. 0 = disabled. E-Mode gives higher LTV when collateral and debt are price-correlated (e.g. stablecoin-to-stablecoin or ETH-to-ETH-derivative).
|
|
37
|
+
*/
|
|
38
|
+
emodeCategoryId?: number | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Human-readable E-Mode category name (e.g. 'Stablecoins', 'ETH correlated'). Null when E-Mode is disabled (category 0).
|
|
41
|
+
*/
|
|
42
|
+
emodeLabel?: string | null | undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const AccountSummary$inboundSchema: z.ZodType<
|
|
47
|
+
AccountSummary,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
unknown
|
|
50
|
+
> = z.object({
|
|
51
|
+
health_factor: z.string(),
|
|
52
|
+
total_collateral_usd: z.string(),
|
|
53
|
+
total_debt_usd: z.string(),
|
|
54
|
+
available_borrows_usd: z.string(),
|
|
55
|
+
ltv: z.string(),
|
|
56
|
+
emode_category_id: z.number().int().optional(),
|
|
57
|
+
emode_label: z.nullable(z.string()).optional(),
|
|
58
|
+
}).transform((v) => {
|
|
59
|
+
return remap$(v, {
|
|
60
|
+
"health_factor": "healthFactor",
|
|
61
|
+
"total_collateral_usd": "totalCollateralUsd",
|
|
62
|
+
"total_debt_usd": "totalDebtUsd",
|
|
63
|
+
"available_borrows_usd": "availableBorrowsUsd",
|
|
64
|
+
"emode_category_id": "emodeCategoryId",
|
|
65
|
+
"emode_label": "emodeLabel",
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export function accountSummaryFromJSON(
|
|
70
|
+
jsonString: string,
|
|
71
|
+
): SafeParseResult<AccountSummary, SDKValidationError> {
|
|
72
|
+
return safeParse(
|
|
73
|
+
jsonString,
|
|
74
|
+
(x) => AccountSummary$inboundSchema.parse(JSON.parse(x)),
|
|
75
|
+
`Failed to parse 'AccountSummary' from JSON`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A token available for borrowing with the maximum borrowable amount.
|
|
13
|
+
*/
|
|
14
|
+
export type BorrowableToken = {
|
|
15
|
+
/**
|
|
16
|
+
* Address of the borrowable token.
|
|
17
|
+
*/
|
|
18
|
+
token: string;
|
|
19
|
+
/**
|
|
20
|
+
* Symbol of the borrowable token (e.g. WETH).
|
|
21
|
+
*/
|
|
22
|
+
symbol: string;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum amount that can be borrowed based on available borrow capacity and token price.
|
|
25
|
+
*/
|
|
26
|
+
maxBorrowableAmount: string;
|
|
27
|
+
/**
|
|
28
|
+
* Current variable borrow APY in percentage (e.g. 4.5 means 4.5%).
|
|
29
|
+
*/
|
|
30
|
+
borrowApy: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const BorrowableToken$inboundSchema: z.ZodType<
|
|
35
|
+
BorrowableToken,
|
|
36
|
+
z.ZodTypeDef,
|
|
37
|
+
unknown
|
|
38
|
+
> = z.object({
|
|
39
|
+
token: z.string(),
|
|
40
|
+
symbol: z.string(),
|
|
41
|
+
max_borrowable_amount: z.string(),
|
|
42
|
+
borrow_apy: z.string(),
|
|
43
|
+
}).transform((v) => {
|
|
44
|
+
return remap$(v, {
|
|
45
|
+
"max_borrowable_amount": "maxBorrowableAmount",
|
|
46
|
+
"borrow_apy": "borrowApy",
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export function borrowableTokenFromJSON(
|
|
51
|
+
jsonString: string,
|
|
52
|
+
): SafeParseResult<BorrowableToken, SDKValidationError> {
|
|
53
|
+
return safeParse(
|
|
54
|
+
jsonString,
|
|
55
|
+
(x) => BorrowableToken$inboundSchema.parse(JSON.parse(x)),
|
|
56
|
+
`Failed to parse 'BorrowableToken' from JSON`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import { CreditEvent, CreditEvent$inboundSchema } from "./creditevent.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A per-reserve collateral position.
|
|
14
|
+
*/
|
|
15
|
+
export type CollateralPosition = {
|
|
16
|
+
/**
|
|
17
|
+
* Address of the collateral token.
|
|
18
|
+
*/
|
|
19
|
+
token: string;
|
|
20
|
+
/**
|
|
21
|
+
* Symbol of the collateral token (e.g. USDC).
|
|
22
|
+
*/
|
|
23
|
+
symbol: string;
|
|
24
|
+
/**
|
|
25
|
+
* Current on-chain aToken balance for the collateral.
|
|
26
|
+
*/
|
|
27
|
+
amountSupplied: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Collateral value in USD.
|
|
30
|
+
*/
|
|
31
|
+
usdValue?: string | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Current supply APY in percentage (e.g. 4.5 means 4.5%).
|
|
34
|
+
*/
|
|
35
|
+
supplyApy?: string | null | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Total collateral deposited over all time.
|
|
38
|
+
*/
|
|
39
|
+
totalDeposited?: string | null | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Total collateral withdrawn over all time.
|
|
42
|
+
*/
|
|
43
|
+
totalWithdrawn?: string | null | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Interest earned on collateral: on_chain_balance + total_withdrawn - total_deposited.
|
|
46
|
+
*/
|
|
47
|
+
interestEarned?: string | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Maximum loan-to-value ratio for this collateral in percentage (e.g. 80 means 80%).
|
|
50
|
+
*/
|
|
51
|
+
maxLtv?: string | null | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* All historical events for this collateral reserve.
|
|
54
|
+
*/
|
|
55
|
+
events?: Array<CreditEvent> | undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const CollateralPosition$inboundSchema: z.ZodType<
|
|
60
|
+
CollateralPosition,
|
|
61
|
+
z.ZodTypeDef,
|
|
62
|
+
unknown
|
|
63
|
+
> = z.object({
|
|
64
|
+
token: z.string(),
|
|
65
|
+
symbol: z.string(),
|
|
66
|
+
amount_supplied: z.nullable(z.string()),
|
|
67
|
+
usd_value: z.nullable(z.string()).optional(),
|
|
68
|
+
supply_apy: z.nullable(z.string()).optional(),
|
|
69
|
+
total_deposited: z.nullable(z.string()).optional(),
|
|
70
|
+
total_withdrawn: z.nullable(z.string()).optional(),
|
|
71
|
+
interest_earned: z.nullable(z.string()).optional(),
|
|
72
|
+
max_ltv: z.nullable(z.string()).optional(),
|
|
73
|
+
events: z.array(CreditEvent$inboundSchema).optional(),
|
|
74
|
+
}).transform((v) => {
|
|
75
|
+
return remap$(v, {
|
|
76
|
+
"amount_supplied": "amountSupplied",
|
|
77
|
+
"usd_value": "usdValue",
|
|
78
|
+
"supply_apy": "supplyApy",
|
|
79
|
+
"total_deposited": "totalDeposited",
|
|
80
|
+
"total_withdrawn": "totalWithdrawn",
|
|
81
|
+
"interest_earned": "interestEarned",
|
|
82
|
+
"max_ltv": "maxLtv",
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export function collateralPositionFromJSON(
|
|
87
|
+
jsonString: string,
|
|
88
|
+
): SafeParseResult<CollateralPosition, SDKValidationError> {
|
|
89
|
+
return safeParse(
|
|
90
|
+
jsonString,
|
|
91
|
+
(x) => CollateralPosition$inboundSchema.parse(JSON.parse(x)),
|
|
92
|
+
`Failed to parse 'CollateralPosition' from JSON`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
|
|
9
|
+
export const CreateCreditAccountRequestChain = {
|
|
10
|
+
Arbitrum: "arbitrum",
|
|
11
|
+
Base: "base",
|
|
12
|
+
Ethereum: "ethereum",
|
|
13
|
+
} as const;
|
|
14
|
+
export type CreateCreditAccountRequestChain = ClosedEnum<
|
|
15
|
+
typeof CreateCreditAccountRequestChain
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Request to create a compass credit account.
|
|
20
|
+
*/
|
|
21
|
+
export type CreateCreditAccountRequest = {
|
|
22
|
+
chain: CreateCreditAccountRequestChain;
|
|
23
|
+
/**
|
|
24
|
+
* The address of the transaction sender.
|
|
25
|
+
*/
|
|
26
|
+
sender: string;
|
|
27
|
+
/**
|
|
28
|
+
* Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
29
|
+
*/
|
|
30
|
+
estimateGas?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The address that will own and control the compass credit account
|
|
33
|
+
*/
|
|
34
|
+
owner: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const CreateCreditAccountRequestChain$outboundSchema: z.ZodNativeEnum<
|
|
39
|
+
typeof CreateCreditAccountRequestChain
|
|
40
|
+
> = z.nativeEnum(CreateCreditAccountRequestChain);
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export type CreateCreditAccountRequest$Outbound = {
|
|
44
|
+
chain: string;
|
|
45
|
+
sender: string;
|
|
46
|
+
estimate_gas?: boolean | undefined;
|
|
47
|
+
owner: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const CreateCreditAccountRequest$outboundSchema: z.ZodType<
|
|
52
|
+
CreateCreditAccountRequest$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
CreateCreditAccountRequest
|
|
55
|
+
> = z.object({
|
|
56
|
+
chain: CreateCreditAccountRequestChain$outboundSchema,
|
|
57
|
+
sender: z.string(),
|
|
58
|
+
estimateGas: z.boolean().optional(),
|
|
59
|
+
owner: z.string(),
|
|
60
|
+
}).transform((v) => {
|
|
61
|
+
return remap$(v, {
|
|
62
|
+
estimateGas: "estimate_gas",
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export function createCreditAccountRequestToJSON(
|
|
67
|
+
createCreditAccountRequest: CreateCreditAccountRequest,
|
|
68
|
+
): string {
|
|
69
|
+
return JSON.stringify(
|
|
70
|
+
CreateCreditAccountRequest$outboundSchema.parse(createCreditAccountRequest),
|
|
71
|
+
);
|
|
72
|
+
}
|