Skip to content

Commit

Permalink
Merge branch 'main' into edu/misc-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Jul 1, 2024
2 parents de448c5 + d17e8b2 commit e3fb45e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/adapters/satsConnectAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ abstract class SatsConnectAdapter {

private async mintRunes(params: Params<'runes_mint'>): Promise<RpcResult<'runes_mint'>> {
try {
const walletInfo = await this.requestInternal('getInfo', null).catch(() => null);
if (walletInfo && walletInfo.status === 'success') {
const isMintSupported = walletInfo.result.methods?.includes('runes_mint');
if (isMintSupported) {
const response = await this.requestInternal('runes_mint', params);
if (response) {
return response;
}
}
}
const mintRequest: Omit<Params<'runes_mint'>, 'network'> = {
destinationAddress: params.destinationAddress,
feeRate: params.feeRate,
Expand Down Expand Up @@ -80,6 +90,16 @@ abstract class SatsConnectAdapter {
appServiceFeeAddress: params.appServiceFeeAddress,
};
try {
const walletInfo = await this.requestInternal('getInfo', null).catch(() => null);
if (walletInfo && walletInfo.status === 'success') {
const isEtchSupported = walletInfo.result.methods?.includes('runes_etch');
if (isEtchSupported) {
const response = await this.requestInternal('runes_etch', params);
if (response) {
return response;
}
}
}
const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
if (!orderResponse.data) {
return {
Expand Down

0 comments on commit e3fb45e

Please sign in to comment.