@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,176 @@
|
|
|
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
|
+
* Borrow against collateral
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Borrow an asset from Aave using a Credit Account.
|
|
33
|
+
*
|
|
34
|
+
* Bundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.
|
|
35
|
+
*
|
|
36
|
+
* - If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral.
|
|
37
|
+
* - If `token_in` differs from `collateral_token`, a swap is performed first via 1inch.
|
|
38
|
+
*
|
|
39
|
+
* The Credit Account must already be created via `/v2/credit/create_account` and funded with `token_in`.
|
|
40
|
+
*/
|
|
41
|
+
export function creditCreditBorrow(
|
|
42
|
+
client: CompassApiSDKCore,
|
|
43
|
+
request: components.CreditBorrowRequest,
|
|
44
|
+
options?: RequestOptions,
|
|
45
|
+
): APIPromise<
|
|
46
|
+
Result<
|
|
47
|
+
components.CreditBorrowResponse,
|
|
48
|
+
| errors.HTTPValidationError
|
|
49
|
+
| CompassAPISDKError
|
|
50
|
+
| ResponseValidationError
|
|
51
|
+
| ConnectionError
|
|
52
|
+
| RequestAbortedError
|
|
53
|
+
| RequestTimeoutError
|
|
54
|
+
| InvalidRequestError
|
|
55
|
+
| UnexpectedClientError
|
|
56
|
+
| SDKValidationError
|
|
57
|
+
>
|
|
58
|
+
> {
|
|
59
|
+
return new APIPromise($do(
|
|
60
|
+
client,
|
|
61
|
+
request,
|
|
62
|
+
options,
|
|
63
|
+
));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function $do(
|
|
67
|
+
client: CompassApiSDKCore,
|
|
68
|
+
request: components.CreditBorrowRequest,
|
|
69
|
+
options?: RequestOptions,
|
|
70
|
+
): Promise<
|
|
71
|
+
[
|
|
72
|
+
Result<
|
|
73
|
+
components.CreditBorrowResponse,
|
|
74
|
+
| errors.HTTPValidationError
|
|
75
|
+
| CompassAPISDKError
|
|
76
|
+
| ResponseValidationError
|
|
77
|
+
| ConnectionError
|
|
78
|
+
| RequestAbortedError
|
|
79
|
+
| RequestTimeoutError
|
|
80
|
+
| InvalidRequestError
|
|
81
|
+
| UnexpectedClientError
|
|
82
|
+
| SDKValidationError
|
|
83
|
+
>,
|
|
84
|
+
APICall,
|
|
85
|
+
]
|
|
86
|
+
> {
|
|
87
|
+
const parsed = safeParse(
|
|
88
|
+
request,
|
|
89
|
+
(value) => components.CreditBorrowRequest$outboundSchema.parse(value),
|
|
90
|
+
"Input validation failed",
|
|
91
|
+
);
|
|
92
|
+
if (!parsed.ok) {
|
|
93
|
+
return [parsed, { status: "invalid" }];
|
|
94
|
+
}
|
|
95
|
+
const payload = parsed.value;
|
|
96
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
97
|
+
|
|
98
|
+
const path = pathToFunc("/v2/credit/borrow")();
|
|
99
|
+
|
|
100
|
+
const headers = new Headers(compactMap({
|
|
101
|
+
"Content-Type": "application/json",
|
|
102
|
+
Accept: "application/json",
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
106
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
107
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
108
|
+
|
|
109
|
+
const context = {
|
|
110
|
+
options: client._options,
|
|
111
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
112
|
+
operationID: "v2_credit_borrow",
|
|
113
|
+
oAuth2Scopes: null,
|
|
114
|
+
|
|
115
|
+
resolvedSecurity: requestSecurity,
|
|
116
|
+
|
|
117
|
+
securitySource: client._options.apiKeyAuth,
|
|
118
|
+
retryConfig: options?.retries
|
|
119
|
+
|| client._options.retryConfig
|
|
120
|
+
|| { strategy: "none" },
|
|
121
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const requestRes = client._createRequest(context, {
|
|
125
|
+
security: requestSecurity,
|
|
126
|
+
method: "POST",
|
|
127
|
+
baseURL: options?.serverURL,
|
|
128
|
+
path: path,
|
|
129
|
+
headers: headers,
|
|
130
|
+
body: body,
|
|
131
|
+
userAgent: client._options.userAgent,
|
|
132
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
133
|
+
}, options);
|
|
134
|
+
if (!requestRes.ok) {
|
|
135
|
+
return [requestRes, { status: "invalid" }];
|
|
136
|
+
}
|
|
137
|
+
const req = requestRes.value;
|
|
138
|
+
|
|
139
|
+
const doResult = await client._do(req, {
|
|
140
|
+
context,
|
|
141
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
142
|
+
retryConfig: context.retryConfig,
|
|
143
|
+
retryCodes: context.retryCodes,
|
|
144
|
+
});
|
|
145
|
+
if (!doResult.ok) {
|
|
146
|
+
return [doResult, { status: "request-error", request: req }];
|
|
147
|
+
}
|
|
148
|
+
const response = doResult.value;
|
|
149
|
+
|
|
150
|
+
const responseFields = {
|
|
151
|
+
HttpMeta: { Response: response, Request: req },
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const [result] = await M.match<
|
|
155
|
+
components.CreditBorrowResponse,
|
|
156
|
+
| errors.HTTPValidationError
|
|
157
|
+
| CompassAPISDKError
|
|
158
|
+
| ResponseValidationError
|
|
159
|
+
| ConnectionError
|
|
160
|
+
| RequestAbortedError
|
|
161
|
+
| RequestTimeoutError
|
|
162
|
+
| InvalidRequestError
|
|
163
|
+
| UnexpectedClientError
|
|
164
|
+
| SDKValidationError
|
|
165
|
+
>(
|
|
166
|
+
M.json(200, components.CreditBorrowResponse$inboundSchema),
|
|
167
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
168
|
+
M.fail("4XX"),
|
|
169
|
+
M.fail("5XX"),
|
|
170
|
+
)(response, req, { extraFields: responseFields });
|
|
171
|
+
if (!result.ok) {
|
|
172
|
+
return [result, { status: "complete", request: req, response }];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return [result, { status: "complete", request: req, response }];
|
|
176
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
* Execute multiple credit actions atomically
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Compose individual credit operations (supply, withdraw, borrow, repay, swap, transfer)
|
|
33
|
+
* into a single atomic Safe transaction.
|
|
34
|
+
*
|
|
35
|
+
* The Credit Account must already be created via `/v2/credit/create_account`.
|
|
36
|
+
*/
|
|
37
|
+
export function creditCreditBundle(
|
|
38
|
+
client: CompassApiSDKCore,
|
|
39
|
+
request: components.CreditBundleRequest,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): APIPromise<
|
|
42
|
+
Result<
|
|
43
|
+
components.CreditBundleResponse,
|
|
44
|
+
| errors.HTTPValidationError
|
|
45
|
+
| CompassAPISDKError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
request,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: CompassApiSDKCore,
|
|
64
|
+
request: components.CreditBundleRequest,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
components.CreditBundleResponse,
|
|
70
|
+
| errors.HTTPValidationError
|
|
71
|
+
| CompassAPISDKError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) => components.CreditBundleRequest$outboundSchema.parse(value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
93
|
+
|
|
94
|
+
const path = pathToFunc("/v2/credit/bundle")();
|
|
95
|
+
|
|
96
|
+
const headers = new Headers(compactMap({
|
|
97
|
+
"Content-Type": "application/json",
|
|
98
|
+
Accept: "application/json",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
102
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
options: client._options,
|
|
107
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
108
|
+
operationID: "v2_credit_bundle",
|
|
109
|
+
oAuth2Scopes: null,
|
|
110
|
+
|
|
111
|
+
resolvedSecurity: requestSecurity,
|
|
112
|
+
|
|
113
|
+
securitySource: client._options.apiKeyAuth,
|
|
114
|
+
retryConfig: options?.retries
|
|
115
|
+
|| client._options.retryConfig
|
|
116
|
+
|| { strategy: "none" },
|
|
117
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const requestRes = client._createRequest(context, {
|
|
121
|
+
security: requestSecurity,
|
|
122
|
+
method: "POST",
|
|
123
|
+
baseURL: options?.serverURL,
|
|
124
|
+
path: path,
|
|
125
|
+
headers: headers,
|
|
126
|
+
body: body,
|
|
127
|
+
userAgent: client._options.userAgent,
|
|
128
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
129
|
+
}, options);
|
|
130
|
+
if (!requestRes.ok) {
|
|
131
|
+
return [requestRes, { status: "invalid" }];
|
|
132
|
+
}
|
|
133
|
+
const req = requestRes.value;
|
|
134
|
+
|
|
135
|
+
const doResult = await client._do(req, {
|
|
136
|
+
context,
|
|
137
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
138
|
+
retryConfig: context.retryConfig,
|
|
139
|
+
retryCodes: context.retryCodes,
|
|
140
|
+
});
|
|
141
|
+
if (!doResult.ok) {
|
|
142
|
+
return [doResult, { status: "request-error", request: req }];
|
|
143
|
+
}
|
|
144
|
+
const response = doResult.value;
|
|
145
|
+
|
|
146
|
+
const responseFields = {
|
|
147
|
+
HttpMeta: { Response: response, Request: req },
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const [result] = await M.match<
|
|
151
|
+
components.CreditBundleResponse,
|
|
152
|
+
| errors.HTTPValidationError
|
|
153
|
+
| CompassAPISDKError
|
|
154
|
+
| ResponseValidationError
|
|
155
|
+
| ConnectionError
|
|
156
|
+
| RequestAbortedError
|
|
157
|
+
| RequestTimeoutError
|
|
158
|
+
| InvalidRequestError
|
|
159
|
+
| UnexpectedClientError
|
|
160
|
+
| SDKValidationError
|
|
161
|
+
>(
|
|
162
|
+
M.json(200, components.CreditBundleResponse$inboundSchema),
|
|
163
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
164
|
+
M.fail("4XX"),
|
|
165
|
+
M.fail("5XX"),
|
|
166
|
+
)(response, req, { extraFields: responseFields });
|
|
167
|
+
if (!result.ok) {
|
|
168
|
+
return [result, { status: "complete", request: req, response }];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return [result, { status: "complete", request: req, response }];
|
|
172
|
+
}
|
|
@@ -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
|
+
* Create credit account
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Create a Credit Account for a wallet address.
|
|
33
|
+
*
|
|
34
|
+
* Before using credit features, the owner must create a Credit Account. Each wallet address has one Credit Account per chain.
|
|
35
|
+
*
|
|
36
|
+
* Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
37
|
+
*
|
|
38
|
+
* **If owner pays gas:** Set `sender` to the owner's address.
|
|
39
|
+
*
|
|
40
|
+
* **If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
41
|
+
*/
|
|
42
|
+
export function creditCreditCreateAccount(
|
|
43
|
+
client: CompassApiSDKCore,
|
|
44
|
+
request: components.CreateCreditAccountRequest,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
Result<
|
|
48
|
+
components.CreateCreditAccountResponse,
|
|
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.CreateCreditAccountRequest,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
components.CreateCreditAccountResponse,
|
|
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) =>
|
|
91
|
+
components.CreateCreditAccountRequest$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/create_account")();
|
|
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_create_account",
|
|
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.CreateCreditAccountResponse,
|
|
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.CreateCreditAccountResponse$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
|
+
}
|
|
@@ -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 { encodeFormQuery } 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 * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List credit positions
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* List all Credit positions for a given owner.
|
|
34
|
+
*
|
|
35
|
+
* Returns a unified list of positions (collateral and debt) and an account summary
|
|
36
|
+
* with health factor and LTV. Each position includes event history.
|
|
37
|
+
*/
|
|
38
|
+
export function creditCreditPositions(
|
|
39
|
+
client: CompassApiSDKCore,
|
|
40
|
+
request: operations.V2CreditPositionsRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
components.CreditPositionsResponse,
|
|
45
|
+
| errors.HTTPValidationError
|
|
46
|
+
| CompassAPISDKError
|
|
47
|
+
| ResponseValidationError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
| RequestAbortedError
|
|
50
|
+
| RequestTimeoutError
|
|
51
|
+
| InvalidRequestError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| SDKValidationError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: CompassApiSDKCore,
|
|
65
|
+
request: operations.V2CreditPositionsRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
components.CreditPositionsResponse,
|
|
71
|
+
| errors.HTTPValidationError
|
|
72
|
+
| CompassAPISDKError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) => operations.V2CreditPositionsRequest$outboundSchema.parse(value),
|
|
87
|
+
"Input validation failed",
|
|
88
|
+
);
|
|
89
|
+
if (!parsed.ok) {
|
|
90
|
+
return [parsed, { status: "invalid" }];
|
|
91
|
+
}
|
|
92
|
+
const payload = parsed.value;
|
|
93
|
+
const body = null;
|
|
94
|
+
|
|
95
|
+
const path = pathToFunc("/v2/credit/positions")();
|
|
96
|
+
|
|
97
|
+
const query = encodeFormQuery({
|
|
98
|
+
"chain": payload.chain,
|
|
99
|
+
"owner": payload.owner,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
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_positions",
|
|
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: "GET",
|
|
128
|
+
baseURL: options?.serverURL,
|
|
129
|
+
path: path,
|
|
130
|
+
headers: headers,
|
|
131
|
+
query: query,
|
|
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.CreditPositionsResponse,
|
|
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.CreditPositionsResponse$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
|
+
}
|