Skip to content

Commit

Permalink
Merge branch 'main' into vic/signet
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeerbes committed Jun 6, 2024
2 parents 66520e6 + e0fff30 commit 2c983fc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 32 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sats-connect/core",
"version": "0.0.9",
"version": "0.0.10",
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/BaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BaseAdapter extends SatsConnectAdapter {
requestInternal = async <Method extends keyof Requests>(
method: Method,
params: Params<Method>
): Promise<RpcResult<Method> | undefined> => {
): Promise<RpcResult<Method>> => {
return request(method, params, this.id);
};
}
Expand Down
34 changes: 8 additions & 26 deletions src/adapters/satsConnectAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ abstract class SatsConnectAdapter {
},
],
});
if (paymentResponse?.status !== 'success') {
return {
status: 'error',
error: {
code: RpcErrorCode.USER_REJECTION,
message: 'User rejected the payment request',
},
};
if (paymentResponse.status !== 'success') {
return paymentResponse;
}
await new RunesApi(params.network).executeMint(
orderResponse.data.orderId,
Expand Down Expand Up @@ -107,14 +101,8 @@ abstract class SatsConnectAdapter {
},
],
});
if (paymentResponse?.status !== 'success') {
return {
status: 'error',
error: {
code: RpcErrorCode.USER_REJECTION,
message: 'User rejected the payment request',
},
};
if (paymentResponse.status !== 'success') {
return paymentResponse;
}
await new RunesApi(params.network).executeEtch(
orderResponse.data.orderId,
Expand Down Expand Up @@ -279,14 +267,8 @@ abstract class SatsConnectAdapter {
},
],
});
if (paymentResponse?.status !== 'success') {
return {
status: 'error',
error: {
code: RpcErrorCode.USER_REJECTION,
message: 'User rejected the payment request',
},
};
if (paymentResponse.status !== 'success') {
return paymentResponse;
}
return {
status: 'success',
Expand All @@ -310,7 +292,7 @@ abstract class SatsConnectAdapter {
async request<Method extends keyof Requests>(
method: Method,
params: Params<Method>
): Promise<RpcResult<Method> | undefined> {
): Promise<RpcResult<Method>> {
switch (method) {
case 'runes_mint':
return this.mintRunes(params as Params<'runes_mint'>) as Promise<RpcResult<Method>>;
Expand Down Expand Up @@ -343,6 +325,6 @@ abstract class SatsConnectAdapter {
protected abstract requestInternal<Method extends keyof Requests>(
method: Method,
params: Params<Method>
): Promise<RpcResult<Method> | undefined>;
): Promise<RpcResult<Method>>;
}
export { SatsConnectAdapter };
2 changes: 1 addition & 1 deletion src/adapters/unisat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class UnisatAdapter extends SatsConnectAdapter {
requestInternal = async <Method extends keyof Requests>(
method: Method,
params: Params<Method>
): Promise<RpcResult<Method> | undefined> => {
): Promise<RpcResult<Method>> => {
try {
switch (method) {
case 'getAccounts': {
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/xverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class XverseAdapter extends SatsConnectAdapter {
requestInternal = async <Method extends keyof Requests>(
method: Method,
params: Params<Method>
): Promise<RpcResult<Method> | undefined> => {
): Promise<RpcResult<Method>> => {
return request(method, params, this.id);
};
}
Expand Down

0 comments on commit 2c983fc

Please sign in to comment.