Skip to content

Commit

Permalink
Merge pull request #49 from haofengjiang/main
Browse files Browse the repository at this point in the history
mpc release rare satoshis
  • Loading branch information
CoboZhu authored Dec 28, 2023
2 parents 4789c86 + d648e60 commit 350afbb
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/MPCClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ export class MPCClient {
return this.coboFetch("POST", "/v1/custody/mpc/generate_addresses/", params)
}

GenerateAddressMemo = (chain_code: string, address: string, count: number) => {
let params: any = {
"chain_code": chain_code,
"address": address,
"count": count,
}
return this.coboFetch("POST", "/v1/custody/mpc/generate_address_memo/", params)
}

UpdateAddressDescription = (coin: string, address: string, description: string) => {
let params: any = {
"coin": coin,
Expand Down Expand Up @@ -145,7 +154,7 @@ export class MPCClient {
CreateTransaction = (coin: string, request_id: string, amount: string, from_addr?: string, to_addr?: string,
to_address_details?: string, fee?: string, gas_price?: BigInt, gas_limit?: BigInt, operation?: number,
extra_parameters?: string, max_fee?: BigInt, max_priority_fee?: BigInt, fee_amount?: BigInt, remark?: string,
auto_fuel?: number) => {
auto_fuel?: number, memo?: string) => {
let params: any = {
"coin": coin,
"request_id": request_id,
Expand Down Expand Up @@ -191,6 +200,9 @@ export class MPCClient {
if (!!auto_fuel) {
params["auto_fuel"] = auto_fuel
}
if (!!memo) {
params["memo"] = memo
}

return this.coboFetch("POST", "/v1/custody/mpc/create_transaction/", params)
}
Expand Down Expand Up @@ -401,6 +413,24 @@ export class MPCClient {
return this.coboFetch("POST", "/v1/custody/mpc/retry_double_check/", params)
}

LockSpendable = (coin: string, tx_hash: string, vout_n: number) => {
let params: any = { "coin": coin, "tx_hash": tx_hash, "vout_n": vout_n }

return this.coboFetch("POST", "/v1/custody/mpc/lock_spendable/", params)
}

UnlockSpendable = (coin: string, tx_hash: string, vout_n: number) => {
let params: any = { "coin": coin, "tx_hash": tx_hash, "vout_n": vout_n }

return this.coboFetch("POST", "/v1/custody/mpc/unlock_spendable/", params)
}

GetRareSatoshis = (coin: string, tx_hash: string, vout_n: number) => {
let params: any = { "coin": coin, "tx_hash": tx_hash, "vout_n": vout_n }

return this.coboFetch("GET", "/v1/custody/mpc/get_rare_satoshis/", params)
}

coboFetch = async (method: string, path: string, params: any): Promise<ApiResponse> => {
let nonce = String(new Date().getTime());
let sort_params = Object.keys(params).sort().map((k) => {
Expand Down

0 comments on commit 350afbb

Please sign in to comment.