-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from secretkeylabs/edu/misc-changes
Support for getBalance
- Loading branch information
Showing
10 changed files
with
267 additions
and
113 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
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
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 |
---|---|---|
@@ -1,80 +1,65 @@ | ||
import { | ||
GetAccounts, | ||
GetAddresses, | ||
GetInfo, | ||
SendTransfer, | ||
SignMessage, | ||
SignPsbt, | ||
} from './btcMethods'; | ||
import { | ||
EstimateRbfOrder, | ||
EstimateRunesEtch, | ||
EstimateRunesMint, | ||
EtchRunes, | ||
GetOrder, | ||
GetRunesBalance, | ||
MintRunes, | ||
RbfOrder, | ||
} from './runesMethods'; | ||
import { | ||
StxCallContract, | ||
StxDeployContract, | ||
StxGetAccounts, | ||
StxGetAddresses, | ||
StxSignStructuredMessage, | ||
StxSignStxMessage, | ||
StxSignTransaction, | ||
StxTransferStx, | ||
} from './stxMethods'; | ||
import { Connect, Disconnect } from './walletMethods'; | ||
import type * as BtcMethods from './btcMethods'; | ||
import { GetInscriptions } from './ordinalsMethods'; | ||
import type * as RunesMethods from './runesMethods'; | ||
import type * as StxMethods from './stxMethods'; | ||
import { RequestPermissions, RenouncePermissions } from './walletMethods'; | ||
|
||
export interface StxRequests { | ||
stx_callContract: StxCallContract; | ||
stx_deployContract: StxDeployContract; | ||
stx_getAccounts: StxGetAccounts; | ||
stx_getAddresses: StxGetAddresses; | ||
stx_signMessage: StxSignStxMessage; | ||
stx_signStructuredMessage: StxSignStructuredMessage; | ||
stx_signTransaction: StxSignTransaction; | ||
stx_transferStx: StxTransferStx; | ||
stx_callContract: StxMethods.StxCallContract; | ||
stx_deployContract: StxMethods.StxDeployContract; | ||
stx_getAccounts: StxMethods.StxGetAccounts; | ||
stx_getAddresses: StxMethods.StxGetAddresses; | ||
stx_signMessage: StxMethods.StxSignStxMessage; | ||
stx_signStructuredMessage: StxMethods.StxSignStructuredMessage; | ||
stx_signTransaction: StxMethods.StxSignTransaction; | ||
stx_transferStx: StxMethods.StxTransferStx; | ||
} | ||
|
||
export type StxRequestMethod = keyof StxRequests; | ||
|
||
export interface BtcRequests { | ||
getInfo: GetInfo; | ||
getAddresses: GetAddresses; | ||
getAccounts: GetAccounts; | ||
signMessage: SignMessage; | ||
sendTransfer: SendTransfer; | ||
signPsbt: SignPsbt; | ||
getInfo: BtcMethods.GetInfo; | ||
getAddresses: BtcMethods.GetAddresses; | ||
getAccounts: BtcMethods.GetAccounts; | ||
getBalance: BtcMethods.GetBalance; | ||
signMessage: BtcMethods.SignMessage; | ||
sendTransfer: BtcMethods.SendTransfer; | ||
signPsbt: BtcMethods.SignPsbt; | ||
} | ||
|
||
export type BtcRequestMethod = keyof BtcRequests; | ||
|
||
export interface RunesRequests { | ||
runes_estimateMint: EstimateRunesMint; | ||
runes_mint: MintRunes; | ||
runes_estimateEtch: EstimateRunesEtch; | ||
runes_etch: EtchRunes; | ||
runes_getOrder: GetOrder; | ||
runes_estimateRbfOrder: EstimateRbfOrder; | ||
runes_rbfOrder: RbfOrder; | ||
runes_getBalance: GetRunesBalance; | ||
runes_estimateMint: RunesMethods.EstimateRunesMint; | ||
runes_mint: RunesMethods.MintRunes; | ||
runes_estimateEtch: RunesMethods.EstimateRunesEtch; | ||
runes_etch: RunesMethods.EtchRunes; | ||
runes_getOrder: RunesMethods.GetOrder; | ||
runes_estimateRbfOrder: RunesMethods.EstimateRbfOrder; | ||
runes_rbfOrder: RunesMethods.RbfOrder; | ||
runes_getBalance: RunesMethods.GetRunesBalance; | ||
} | ||
|
||
export type RunesRequestMethod = keyof RunesRequests; | ||
|
||
export interface OrdinalsRequests { | ||
ord_getInscriptions: GetInscriptions; | ||
} | ||
|
||
export type OrdinalsRequestMethod = keyof OrdinalsRequests; | ||
|
||
export interface WalletMethods { | ||
wallet_connect: Connect; | ||
wallet_disconnect: Disconnect; | ||
wallet_requestPermissions: RequestPermissions; | ||
wallet_renouncePermissions: RenouncePermissions; | ||
} | ||
|
||
export type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods; | ||
export type Requests = BtcRequests & StxRequests & RunesRequests & WalletMethods & OrdinalsRequests; | ||
|
||
export type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never; | ||
export type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never; | ||
|
||
export * from './stxMethods'; | ||
export * from './btcMethods'; | ||
export * from './walletMethods'; | ||
export * from './runesMethods'; | ||
export * from './ordinalsMethods'; |
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,38 @@ | ||
import { MethodParamsAndResult, rpcRequestMessageSchema } from '../../types'; | ||
import * as v from 'valibot'; | ||
|
||
export const getInscriptionsMethodName = 'ord_getInscriptions'; | ||
export const getInscriptionsParamsSchema = v.object({ | ||
offset: v.number(), | ||
limit: v.number(), | ||
}); | ||
export const getInscriptionsResultSchema = v.object({ | ||
inscriptions: v.array( | ||
v.object({ | ||
inscriptionId: v.string(), | ||
inscriptionNumber: v.string(), | ||
address: v.string(), | ||
collectionName: v.optional(v.string()), | ||
postage: v.string(), | ||
contentLength: v.string(), | ||
contentType: v.string(), | ||
timestamp: v.number(), | ||
offset: v.number(), | ||
genesisTransaction: v.string(), | ||
output: v.string(), | ||
}) | ||
), | ||
}); | ||
export const getInscriptionsSchema = v.object({ | ||
...rpcRequestMessageSchema.entries, | ||
...v.object({ | ||
method: v.literal(getInscriptionsMethodName), | ||
params: getInscriptionsParamsSchema, | ||
id: v.string(), | ||
}).entries, | ||
}); | ||
|
||
export type GetInscriptions = MethodParamsAndResult< | ||
v.InferOutput<typeof getInscriptionsParamsSchema>, | ||
v.InferOutput<typeof getInscriptionsResultSchema> | ||
>; |
Oops, something went wrong.