-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update getWalletHistory. (#1216)
- Loading branch information
Showing
9 changed files
with
326 additions
and
10 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,7 @@ | ||
--- | ||
'@moralisweb3/common-evm-utils': patch | ||
'@moralisweb3/evm-api': patch | ||
'moralis': patch | ||
--- | ||
|
||
Update the return types of the `getWalletHistory` method. |
64 changes: 64 additions & 0 deletions
64
packages/common/evmUtils/src/generated/types/EvmCommonContractData.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,64 @@ | ||
import { EvmContractTokenDetails, EvmContractTokenDetailsInput, EvmContractTokenDetailsJSON } from '../types/EvmContractTokenDetails'; | ||
import { EvmContractSpenderDetails, EvmContractSpenderDetailsInput, EvmContractSpenderDetailsJSON } from '../types/EvmContractSpenderDetails'; | ||
|
||
// $ref: #/components/schemas/CommonContractData | ||
// type: CommonContractData | ||
// properties: | ||
// - value ($ref: #/components/schemas/CommonContractData/properties/value) | ||
// - value_formatted ($ref: #/components/schemas/CommonContractData/properties/value_formatted) | ||
// - token ($ref: #/components/schemas/ContractTokenDetails) | ||
// - spender ($ref: #/components/schemas/ContractSpenderDetails) | ||
|
||
export interface EvmCommonContractDataJSON { | ||
readonly value: string; | ||
readonly value_formatted?: string; | ||
readonly token: EvmContractTokenDetailsJSON; | ||
readonly spender: EvmContractSpenderDetailsJSON; | ||
} | ||
|
||
export interface EvmCommonContractDataInput { | ||
readonly value: string; | ||
readonly valueFormatted?: string; | ||
readonly token: EvmContractTokenDetailsInput | EvmContractTokenDetails; | ||
readonly spender: EvmContractSpenderDetailsInput | EvmContractSpenderDetails; | ||
} | ||
|
||
export class EvmCommonContractData { | ||
public static create(input: EvmCommonContractDataInput | EvmCommonContractData): EvmCommonContractData { | ||
if (input instanceof EvmCommonContractData) { | ||
return input; | ||
} | ||
return new EvmCommonContractData(input); | ||
} | ||
|
||
public static fromJSON(json: EvmCommonContractDataJSON): EvmCommonContractData { | ||
const input: EvmCommonContractDataInput = { | ||
value: json.value, | ||
valueFormatted: json.value_formatted, | ||
token: EvmContractTokenDetails.fromJSON(json.token), | ||
spender: EvmContractSpenderDetails.fromJSON(json.spender), | ||
}; | ||
return EvmCommonContractData.create(input); | ||
} | ||
|
||
public readonly value: string; | ||
public readonly valueFormatted?: string; | ||
public readonly token: EvmContractTokenDetails; | ||
public readonly spender: EvmContractSpenderDetails; | ||
|
||
private constructor(input: EvmCommonContractDataInput) { | ||
this.value = input.value; | ||
this.valueFormatted = input.valueFormatted; | ||
this.token = EvmContractTokenDetails.create(input.token); | ||
this.spender = EvmContractSpenderDetails.create(input.spender); | ||
} | ||
|
||
public toJSON(): EvmCommonContractDataJSON { | ||
return { | ||
value: this.value, | ||
value_formatted: this.valueFormatted, | ||
token: this.token.toJSON(), | ||
spender: this.spender.toJSON(), | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
packages/common/evmUtils/src/generated/types/EvmContractSpenderDetails.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,70 @@ | ||
import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; | ||
|
||
// $ref: #/components/schemas/ContractSpenderDetails | ||
// type: ContractSpenderDetails | ||
// properties: | ||
// - address ($ref: #/components/schemas/ContractSpenderDetails/properties/address) | ||
// - address_label ($ref: #/components/schemas/ContractSpenderDetails/properties/address_label) | ||
// - name ($ref: #/components/schemas/ContractSpenderDetails/properties/name) | ||
// - symbol ($ref: #/components/schemas/ContractSpenderDetails/properties/symbol) | ||
// - logo ($ref: #/components/schemas/ContractSpenderDetails/properties/logo) | ||
|
||
export interface EvmContractSpenderDetailsJSON { | ||
readonly address: EvmAddressJSON; | ||
readonly address_label?: string; | ||
readonly name?: string; | ||
readonly symbol?: string; | ||
readonly logo?: string; | ||
} | ||
|
||
export interface EvmContractSpenderDetailsInput { | ||
readonly address: EvmAddressInput | EvmAddress; | ||
readonly addressLabel?: string; | ||
readonly name?: string; | ||
readonly symbol?: string; | ||
readonly logo?: string; | ||
} | ||
|
||
export class EvmContractSpenderDetails { | ||
public static create(input: EvmContractSpenderDetailsInput | EvmContractSpenderDetails): EvmContractSpenderDetails { | ||
if (input instanceof EvmContractSpenderDetails) { | ||
return input; | ||
} | ||
return new EvmContractSpenderDetails(input); | ||
} | ||
|
||
public static fromJSON(json: EvmContractSpenderDetailsJSON): EvmContractSpenderDetails { | ||
const input: EvmContractSpenderDetailsInput = { | ||
address: EvmAddress.fromJSON(json.address), | ||
addressLabel: json.address_label, | ||
name: json.name, | ||
symbol: json.symbol, | ||
logo: json.logo, | ||
}; | ||
return EvmContractSpenderDetails.create(input); | ||
} | ||
|
||
public readonly address: EvmAddress; | ||
public readonly addressLabel?: string; | ||
public readonly name?: string; | ||
public readonly symbol?: string; | ||
public readonly logo?: string; | ||
|
||
private constructor(input: EvmContractSpenderDetailsInput) { | ||
this.address = EvmAddress.create(input.address); | ||
this.addressLabel = input.addressLabel; | ||
this.name = input.name; | ||
this.symbol = input.symbol; | ||
this.logo = input.logo; | ||
} | ||
|
||
public toJSON(): EvmContractSpenderDetailsJSON { | ||
return { | ||
address: this.address.toJSON(), | ||
address_label: this.addressLabel, | ||
name: this.name, | ||
symbol: this.symbol, | ||
logo: this.logo, | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
packages/common/evmUtils/src/generated/types/EvmContractTokenDetails.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,70 @@ | ||
import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; | ||
|
||
// $ref: #/components/schemas/ContractTokenDetails | ||
// type: ContractTokenDetails | ||
// properties: | ||
// - address ($ref: #/components/schemas/ContractTokenDetails/properties/address) | ||
// - address_label ($ref: #/components/schemas/ContractTokenDetails/properties/address_label) | ||
// - token_name ($ref: #/components/schemas/ContractTokenDetails/properties/token_name) | ||
// - token_logo ($ref: #/components/schemas/ContractTokenDetails/properties/token_logo) | ||
// - token_symbol ($ref: #/components/schemas/ContractTokenDetails/properties/token_symbol) | ||
|
||
export interface EvmContractTokenDetailsJSON { | ||
readonly address: EvmAddressJSON; | ||
readonly address_label?: string; | ||
readonly token_name: string; | ||
readonly token_logo: string; | ||
readonly token_symbol: string; | ||
} | ||
|
||
export interface EvmContractTokenDetailsInput { | ||
readonly address: EvmAddressInput | EvmAddress; | ||
readonly addressLabel?: string; | ||
readonly tokenName: string; | ||
readonly tokenLogo: string; | ||
readonly tokenSymbol: string; | ||
} | ||
|
||
export class EvmContractTokenDetails { | ||
public static create(input: EvmContractTokenDetailsInput | EvmContractTokenDetails): EvmContractTokenDetails { | ||
if (input instanceof EvmContractTokenDetails) { | ||
return input; | ||
} | ||
return new EvmContractTokenDetails(input); | ||
} | ||
|
||
public static fromJSON(json: EvmContractTokenDetailsJSON): EvmContractTokenDetails { | ||
const input: EvmContractTokenDetailsInput = { | ||
address: EvmAddress.fromJSON(json.address), | ||
addressLabel: json.address_label, | ||
tokenName: json.token_name, | ||
tokenLogo: json.token_logo, | ||
tokenSymbol: json.token_symbol, | ||
}; | ||
return EvmContractTokenDetails.create(input); | ||
} | ||
|
||
public readonly address: EvmAddress; | ||
public readonly addressLabel?: string; | ||
public readonly tokenName: string; | ||
public readonly tokenLogo: string; | ||
public readonly tokenSymbol: string; | ||
|
||
private constructor(input: EvmContractTokenDetailsInput) { | ||
this.address = EvmAddress.create(input.address); | ||
this.addressLabel = input.addressLabel; | ||
this.tokenName = input.tokenName; | ||
this.tokenLogo = input.tokenLogo; | ||
this.tokenSymbol = input.tokenSymbol; | ||
} | ||
|
||
public toJSON(): EvmContractTokenDetailsJSON { | ||
return { | ||
address: this.address.toJSON(), | ||
address_label: this.addressLabel, | ||
token_name: this.tokenName, | ||
token_logo: this.tokenLogo, | ||
token_symbol: this.tokenSymbol, | ||
} | ||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
packages/common/evmUtils/src/generated/types/EvmResolveContractInteractionResponse.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,63 @@ | ||
import { EvmCommonContractData, EvmCommonContractDataInput, EvmCommonContractDataJSON } from '../types/EvmCommonContractData'; | ||
|
||
// $ref: #/components/schemas/ResolveContractInteractionResponse | ||
// type: ResolveContractInteractionResponse | ||
// properties: | ||
// - approvals ($ref: #/components/schemas/CommonContractData) | ||
// - revokes ($ref: #/components/schemas/CommonContractData) | ||
// - approvalsAll ($ref: #/components/schemas/CommonContractData) | ||
// - revokesAll ($ref: #/components/schemas/CommonContractData) | ||
|
||
export interface EvmResolveContractInteractionResponseJSON { | ||
readonly approvals?: EvmCommonContractDataJSON[]; | ||
readonly revokes?: EvmCommonContractDataJSON[]; | ||
readonly approvalsAll?: EvmCommonContractDataJSON[]; | ||
readonly revokesAll?: EvmCommonContractDataJSON[]; | ||
} | ||
|
||
export interface EvmResolveContractInteractionResponseInput { | ||
readonly approvals?: EvmCommonContractDataInput[] | EvmCommonContractData[]; | ||
readonly revokes?: EvmCommonContractDataInput[] | EvmCommonContractData[]; | ||
readonly approvalsAll?: EvmCommonContractDataInput[] | EvmCommonContractData[]; | ||
readonly revokesAll?: EvmCommonContractDataInput[] | EvmCommonContractData[]; | ||
} | ||
|
||
export class EvmResolveContractInteractionResponse { | ||
public static create(input: EvmResolveContractInteractionResponseInput | EvmResolveContractInteractionResponse): EvmResolveContractInteractionResponse { | ||
if (input instanceof EvmResolveContractInteractionResponse) { | ||
return input; | ||
} | ||
return new EvmResolveContractInteractionResponse(input); | ||
} | ||
|
||
public static fromJSON(json: EvmResolveContractInteractionResponseJSON): EvmResolveContractInteractionResponse { | ||
const input: EvmResolveContractInteractionResponseInput = { | ||
approvals: json.approvals ? json.approvals.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, | ||
revokes: json.revokes ? json.revokes.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, | ||
approvalsAll: json.approvalsAll ? json.approvalsAll.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, | ||
revokesAll: json.revokesAll ? json.revokesAll.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, | ||
}; | ||
return EvmResolveContractInteractionResponse.create(input); | ||
} | ||
|
||
public readonly approvals?: EvmCommonContractData[]; | ||
public readonly revokes?: EvmCommonContractData[]; | ||
public readonly approvalsAll?: EvmCommonContractData[]; | ||
public readonly revokesAll?: EvmCommonContractData[]; | ||
|
||
private constructor(input: EvmResolveContractInteractionResponseInput) { | ||
this.approvals = input.approvals ? input.approvals.map((item) => EvmCommonContractData.create(item)) : undefined; | ||
this.revokes = input.revokes ? input.revokes.map((item) => EvmCommonContractData.create(item)) : undefined; | ||
this.approvalsAll = input.approvalsAll ? input.approvalsAll.map((item) => EvmCommonContractData.create(item)) : undefined; | ||
this.revokesAll = input.revokesAll ? input.revokesAll.map((item) => EvmCommonContractData.create(item)) : undefined; | ||
} | ||
|
||
public toJSON(): EvmResolveContractInteractionResponseJSON { | ||
return { | ||
approvals: this.approvals ? this.approvals.map((item) => item.toJSON()) : undefined, | ||
revokes: this.revokes ? this.revokes.map((item) => item.toJSON()) : undefined, | ||
approvalsAll: this.approvalsAll ? this.approvalsAll.map((item) => item.toJSON()) : undefined, | ||
revokesAll: this.revokesAll ? this.revokesAll.map((item) => item.toJSON()) : undefined, | ||
} | ||
} | ||
} |
Oops, something went wrong.
6bd790d
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