New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@coinbase/coinbase-sdk

Package Overview
Dependencies
Maintainers
9
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coinbase/coinbase-sdk - npm Package Compare versions

Comparing version

to
0.17.0

9

dist/coinbase/address/external_address.d.ts
import { Address } from "../address";
import { Amount, StakeOptionsMode } from "../types";
import { Amount, BroadcastExternalTransactionResponse, StakeOptionsMode } from "../types";
import { StakingOperation } from "../staking_operation";

@@ -81,2 +81,9 @@ /**

private buildStakingOperation;
/**
* Broadcast an external transaction
*
* @param signedPayload - The signed payload of the transaction to broadcast
* @returns The broadcasted transaction
*/
broadcastExternalTransaction(signedPayload: string): Promise<BroadcastExternalTransactionResponse>;
}

@@ -111,3 +111,18 @@ "use strict";

}
/**
* Broadcast an external transaction
*
* @param signedPayload - The signed payload of the transaction to broadcast
* @returns The broadcasted transaction
*/
async broadcastExternalTransaction(signedPayload) {
const response = await coinbase_1.Coinbase.apiClients.externalAddress.broadcastExternalTransaction(this.getNetworkId(), this.getId(), {
signed_payload: signedPayload,
});
return {
transactionHash: response.data.transaction_hash,
transactionLink: response.data.transaction_link,
};
}
}
exports.ExternalAddress = ExternalAddress;

@@ -20,2 +20,3 @@ import { ApiClients, CoinbaseConfigureFromJsonOptions, CoinbaseOptions } from "./types";

readonly EthereumHolesky: "ethereum-holesky";
readonly EthereumSepolia: "ethereum-sepolia";
readonly EthereumMainnet: "ethereum-mainnet";

@@ -26,2 +27,6 @@ readonly PolygonMainnet: "polygon-mainnet";

readonly ArbitrumMainnet: "arbitrum-mainnet";
readonly ArbitrumSepolia: "arbitrum-sepolia";
readonly BitcoinMainnet: "bitcoin-mainnet";
readonly NearTestnet: "near-testnet";
readonly NearMainnet: "near-mainnet";
};

@@ -28,0 +33,0 @@ /**

import { Decimal } from "decimal.js";
import { AxiosPromise, AxiosRequestConfig, RawAxiosRequestConfig } from "axios";
import { Address as AddressModel, AddressList, AddressBalanceList, AddressHistoricalBalanceList, Balance, CreateAddressRequest, CreateWalletRequest, BroadcastTransferRequest, CreateTransferRequest, TransferList, Wallet as WalletModel, Transfer as TransferModel, Trade as TradeModel, Asset as AssetModel, WalletList, TradeList as TradeListModel, CreateTradeRequest, BroadcastTradeRequest, ServerSignerList, BuildStakingOperationRequest, StakingOperation as StakingOperationModel, GetStakingContextRequest, StakingContext as StakingContextModel, FetchStakingRewardsRequest, FetchStakingRewards200Response, FetchHistoricalStakingBalances200Response, FaucetTransaction, BroadcastStakingOperationRequest, CreateStakingOperationRequest, ValidatorList, Validator, ValidatorStatus as APIValidatorStatus, Webhook as WebhookModel, WebhookList, CreateWebhookRequest, UpdateWebhookRequest, ContractEventList, CreatePayloadSignatureRequest, PayloadSignature as PayloadSignatureModel, PayloadSignatureList, WebhookEventType, WebhookEventFilter, AddressTransactionList, BroadcastContractInvocationRequest, CreateContractInvocationRequest, ContractInvocationList, ContractInvocation as ContractInvocationModel, SmartContractList, CreateSmartContractRequest, SmartContract as SmartContractModel, FundOperation as FundOperationModel, FundQuote as FundQuoteModel, DeploySmartContractRequest, WebhookEventTypeFilter, CreateWalletWebhookRequest, ReadContractRequest, SolidityValue, FundOperationList, CreateFundOperationRequest, CreateFundQuoteRequest, AddressReputation, RegisterSmartContractRequest, UpdateSmartContractRequest, CompileSmartContractRequest, CompiledSmartContract } from "./../client/api";
import { Address as AddressModel, AddressList, AddressBalanceList, AddressHistoricalBalanceList, Balance, CreateAddressRequest, CreateWalletRequest, BroadcastTransferRequest, CreateTransferRequest, TransferList, Wallet as WalletModel, Transfer as TransferModel, Trade as TradeModel, Asset as AssetModel, WalletList, TradeList as TradeListModel, CreateTradeRequest, BroadcastTradeRequest, ServerSignerList, BuildStakingOperationRequest, StakingOperation as StakingOperationModel, GetStakingContextRequest, StakingContext as StakingContextModel, FetchStakingRewardsRequest, FetchStakingRewards200Response, FetchHistoricalStakingBalances200Response, FaucetTransaction, BroadcastStakingOperationRequest, CreateStakingOperationRequest, ValidatorList, Validator, ValidatorStatus as APIValidatorStatus, Webhook as WebhookModel, WebhookList, CreateWebhookRequest, UpdateWebhookRequest, ContractEventList, CreatePayloadSignatureRequest, PayloadSignature as PayloadSignatureModel, PayloadSignatureList, WebhookEventType, WebhookEventFilter, AddressTransactionList, BroadcastContractInvocationRequest, CreateContractInvocationRequest, ContractInvocationList, ContractInvocation as ContractInvocationModel, SmartContractList, CreateSmartContractRequest, SmartContract as SmartContractModel, FundOperation as FundOperationModel, FundQuote as FundQuoteModel, DeploySmartContractRequest, WebhookEventTypeFilter, CreateWalletWebhookRequest, ReadContractRequest, SolidityValue, FundOperationList, CreateFundOperationRequest, CreateFundQuoteRequest, AddressReputation, RegisterSmartContractRequest, UpdateSmartContractRequest, CompileSmartContractRequest, CompiledSmartContract, BroadcastExternalTransactionRequest, BroadcastExternalTransaction200Response } from "./../client/api";
import { Address } from "./address";

@@ -256,2 +256,12 @@ import { Wallet } from "./wallet";

getFaucetTransaction(networkId: string, addressId: string, transactionHash: string, options?: RawAxiosRequestConfig): AxiosPromise<FaucetTransaction>;
/**
* Broadcast an external transaction
*
* @param networkId - The ID of the blockchain network
* @param addressId - The ID of the address to broadcast the transaction for
* @param broadcastExternalTransactionRequest - The request body
* @param options - Override http request option.
* @throws {APIError} If the request fails.
*/
broadcastExternalTransaction(networkId: string, addressId: string, broadcastExternalTransactionRequest: BroadcastExternalTransactionRequest, options?: RawAxiosRequestConfig): AxiosPromise<BroadcastExternalTransaction200Response>;
};

@@ -1174,1 +1184,8 @@ export type WalletStakeAPIClient = {

}
/**
* Response from broadcasting an external transaction
*/
export interface BroadcastExternalTransactionResponse {
transactionHash: string;
transactionLink?: string;
}

@@ -552,2 +552,18 @@ "use strict";

});
describe("#broadcastExternalTransaction", () => {
it("should successfully broadcast an external transaction", async () => {
coinbase_1.Coinbase.apiClients.externalAddress.broadcastExternalTransaction = (0, utils_1.mockReturnValue)({
transaction_hash: "transactionHash",
transaction_link: "transactionLink",
});
const response = await address.broadcastExternalTransaction("signedPayload");
expect(response).toEqual({
transactionHash: "transactionHash",
transactionLink: "transactionLink",
});
expect(coinbase_1.Coinbase.apiClients.externalAddress.broadcastExternalTransaction).toHaveBeenCalledWith(address.getNetworkId(), address.getId(), {
signed_payload: "signedPayload",
});
});
});
});

@@ -168,2 +168,3 @@ /// <reference types="jest" />

getFaucetTransaction: jest.Mock<any, any, any>;
broadcastExternalTransaction: jest.Mock<any, any, any>;
};

@@ -170,0 +171,0 @@ export declare const balanceHistoryApiMock: {

@@ -700,2 +700,3 @@ "use strict";

getFaucetTransaction: jest.fn(),
broadcastExternalTransaction: jest.fn(),
};

@@ -702,0 +703,0 @@ exports.balanceHistoryApiMock = {

@@ -5,2 +5,3 @@ "use strict";

const coinbase_1 = require("../coinbase/coinbase");
const api_1 = require("../client/api");
const utils_1 = require("./utils");

@@ -15,2 +16,3 @@ const api_error_1 = require("../coinbase/api_error");

event_filters: [{ contract_address: "0x...", from_address: "0x...", to_address: "0x..." }],
status: api_1.WebhookStatus.Active,
};

@@ -26,2 +28,3 @@ const mockWalletActivityWebhookModel = {

},
status: api_1.WebhookStatus.Active,
};

@@ -36,2 +39,3 @@ const mockContractActivityWebhookModel = {

},
status: api_1.WebhookStatus.Active,
};

@@ -38,0 +42,0 @@ beforeEach(() => {

2

package.json

@@ -7,3 +7,3 @@ {

"repository": "https://github.com/coinbase/coinbase-sdk-nodejs",
"version": "0.16.0",
"version": "0.17.0",
"main": "dist/index.js",

@@ -10,0 +10,0 @@ "types": "dist/index.d.ts",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display