-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9caca5
commit 26d2a2e
Showing
24 changed files
with
1,300 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@moralisweb3/common-evm-utils': patch | ||
'@moralisweb3/evm-api': patch | ||
--- | ||
|
||
Adding new DeFi endpoints to the SDK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
packages/common/evmUtils/src/generated/operations/GetDefiPositionsByProtocolOperation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; | ||
import { EvmDefiProtocolList, EvmDefiProtocolListValue, EvmDefiProtocolListInput, EvmDefiProtocolListJSON } from '../types/EvmDefiProtocolList'; | ||
import { EvmGetDefiPositionsByProtocol, EvmGetDefiPositionsByProtocolJSON } from '../types/EvmGetDefiPositionsByProtocol'; | ||
|
||
// request parameters: | ||
// - chain ($ref: #/components/schemas/chainList) | ||
// - address ($ref: #/paths/~1wallets~1{address}~1defi~1{protocol}~1positions/get/parameters/1/schema) | ||
// - protocol ($ref: #/components/schemas/defiProtocolList) | ||
|
||
export interface GetDefiPositionsByProtocolOperationRequest { | ||
/** | ||
* @description The chain to query | ||
*/ | ||
readonly chain?: EvmChainInput | EvmChain; | ||
/** | ||
* @description Wallet address | ||
*/ | ||
readonly address: EvmAddressInput | EvmAddress; | ||
/** | ||
* @description The protocol to query | ||
*/ | ||
readonly protocol: EvmDefiProtocolListInput | EvmDefiProtocolListValue; | ||
} | ||
|
||
export interface GetDefiPositionsByProtocolOperationRequestJSON { | ||
readonly chain?: EvmChainJSON; | ||
readonly address: EvmAddressJSON; | ||
readonly protocol: EvmDefiProtocolListJSON; | ||
} | ||
|
||
export type GetDefiPositionsByProtocolOperationResponse = EvmGetDefiPositionsByProtocol; | ||
export type GetDefiPositionsByProtocolOperationResponseJSON = EvmGetDefiPositionsByProtocolJSON; | ||
|
||
export const GetDefiPositionsByProtocolOperation = { | ||
operationId: "getDefiPositionsByProtocol", | ||
groupName: "wallets", | ||
httpMethod: "get", | ||
routePattern: "/wallets/{address}/defi/{protocol}/positions", | ||
parameterNames: ["chain","address","protocol"], | ||
hasResponse: true, | ||
hasBody: false, | ||
|
||
parseResponse(json: EvmGetDefiPositionsByProtocolJSON): EvmGetDefiPositionsByProtocol { | ||
return EvmGetDefiPositionsByProtocol.fromJSON(json); | ||
}, | ||
|
||
serializeRequest(request: GetDefiPositionsByProtocolOperationRequest): GetDefiPositionsByProtocolOperationRequestJSON { | ||
const chain = request.chain ? EvmChain.create(request.chain) : undefined; | ||
const address = EvmAddress.create(request.address); | ||
const protocol = EvmDefiProtocolList.create(request.protocol); | ||
return { | ||
chain: chain ? chain.toJSON() : undefined, | ||
address: address.toJSON(), | ||
protocol: protocol, | ||
}; | ||
}, | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
packages/common/evmUtils/src/generated/operations/GetDefiPositionsSummaryOperation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; | ||
import { EvmDefiPositionSummaryResponse, EvmDefiPositionSummaryResponseJSON } from '../types/EvmDefiPositionSummaryResponse'; | ||
|
||
// request parameters: | ||
// - chain ($ref: #/components/schemas/chainList) | ||
// - address ($ref: #/paths/~1wallets~1{address}~1defi~1positions/get/parameters/1/schema) | ||
|
||
export interface GetDefiPositionsSummaryOperationRequest { | ||
/** | ||
* @description The chain to query | ||
*/ | ||
readonly chain?: EvmChainInput | EvmChain; | ||
/** | ||
* @description Wallet address | ||
*/ | ||
readonly address: EvmAddressInput | EvmAddress; | ||
} | ||
|
||
export interface GetDefiPositionsSummaryOperationRequestJSON { | ||
readonly chain?: EvmChainJSON; | ||
readonly address: EvmAddressJSON; | ||
} | ||
|
||
export type GetDefiPositionsSummaryOperationResponse = EvmDefiPositionSummaryResponse[]; | ||
export type GetDefiPositionsSummaryOperationResponseJSON = EvmDefiPositionSummaryResponseJSON[]; | ||
|
||
export const GetDefiPositionsSummaryOperation = { | ||
operationId: "getDefiPositionsSummary", | ||
groupName: "wallets", | ||
httpMethod: "get", | ||
routePattern: "/wallets/{address}/defi/positions", | ||
parameterNames: ["chain","address"], | ||
hasResponse: true, | ||
hasBody: false, | ||
|
||
parseResponse(json: EvmDefiPositionSummaryResponseJSON[]): EvmDefiPositionSummaryResponse[] { | ||
return json.map((item) => EvmDefiPositionSummaryResponse.fromJSON(item)); | ||
}, | ||
|
||
serializeRequest(request: GetDefiPositionsSummaryOperationRequest): GetDefiPositionsSummaryOperationRequestJSON { | ||
const chain = request.chain ? EvmChain.create(request.chain) : undefined; | ||
const address = EvmAddress.create(request.address); | ||
return { | ||
chain: chain ? chain.toJSON() : undefined, | ||
address: address.toJSON(), | ||
}; | ||
}, | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
packages/common/evmUtils/src/generated/operations/GetDefiSummaryOperation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; | ||
import { EvmWalletDefiSummary, EvmWalletDefiSummaryJSON } from '../types/EvmWalletDefiSummary'; | ||
|
||
// request parameters: | ||
// - chain ($ref: #/components/schemas/chainList) | ||
// - address ($ref: #/paths/~1wallets~1{address}~1defi~1summary/get/parameters/1/schema) | ||
|
||
export interface GetDefiSummaryOperationRequest { | ||
/** | ||
* @description The chain to query | ||
*/ | ||
readonly chain?: EvmChainInput | EvmChain; | ||
/** | ||
* @description Wallet address | ||
*/ | ||
readonly address: EvmAddressInput | EvmAddress; | ||
} | ||
|
||
export interface GetDefiSummaryOperationRequestJSON { | ||
readonly chain?: EvmChainJSON; | ||
readonly address: EvmAddressJSON; | ||
} | ||
|
||
export type GetDefiSummaryOperationResponse = EvmWalletDefiSummary; | ||
export type GetDefiSummaryOperationResponseJSON = EvmWalletDefiSummaryJSON; | ||
|
||
export const GetDefiSummaryOperation = { | ||
operationId: "getDefiSummary", | ||
groupName: "wallets", | ||
httpMethod: "get", | ||
routePattern: "/wallets/{address}/defi/summary", | ||
parameterNames: ["chain","address"], | ||
hasResponse: true, | ||
hasBody: false, | ||
|
||
parseResponse(json: EvmWalletDefiSummaryJSON): EvmWalletDefiSummary { | ||
return EvmWalletDefiSummary.fromJSON(json); | ||
}, | ||
|
||
serializeRequest(request: GetDefiSummaryOperationRequest): GetDefiSummaryOperationRequestJSON { | ||
const chain = request.chain ? EvmChain.create(request.chain) : undefined; | ||
const address = EvmAddress.create(request.address); | ||
return { | ||
chain: chain ? chain.toJSON() : undefined, | ||
address: address.toJSON(), | ||
}; | ||
}, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
26d2a2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test coverage