@coinbase/coinbase-sdk
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -89,4 +89,4 @@ "use strict"; | ||
let transfer = transfer_1.Transfer.fromModel(response.data); | ||
const wallet = new ethers_1.ethers.Wallet(this.key.privateKey); | ||
if (!coinbase_1.Coinbase.useServerSigner) { | ||
const wallet = new ethers_1.ethers.Wallet(this.key.privateKey); | ||
const transaction = transfer.getTransaction(); | ||
@@ -93,0 +93,0 @@ let signedPayload = await wallet.signTransaction(transaction); |
@@ -191,2 +191,3 @@ "use strict"; | ||
coinbase_1.Coinbase.apiClients.transfer = utils_1.transfersApiMock; | ||
coinbase_1.Coinbase.useServerSigner = false; | ||
}); | ||
@@ -234,2 +235,20 @@ it("should successfully create and complete a transfer", async () => { | ||
}); | ||
it("it should successfully create and complete a transfer if using signer and key is not loaded", async () => { | ||
coinbase_1.Coinbase.apiClients.transfer.createTransfer = (0, utils_1.mockReturnValue)(utils_1.VALID_TRANSFER_MODEL); | ||
coinbase_1.Coinbase.apiClients.transfer.getTransfer = (0, utils_1.mockReturnValue)({ | ||
...utils_1.VALID_TRANSFER_MODEL, | ||
status: types_1.TransferStatus.COMPLETE, | ||
}); | ||
coinbase_1.Coinbase.useServerSigner = true; | ||
const addressWithoutKey = new wallet_address_1.WalletAddress(utils_1.VALID_ADDRESS_MODEL, null); | ||
await addressWithoutKey.createTransfer({ | ||
amount: weiAmount, | ||
assetId: coinbase_1.Coinbase.assets.Wei, | ||
destination, | ||
timeoutSeconds, | ||
intervalSeconds, | ||
}); | ||
expect(coinbase_1.Coinbase.apiClients.transfer.createTransfer).toHaveBeenCalledTimes(1); | ||
expect(coinbase_1.Coinbase.apiClients.transfer.getTransfer).toHaveBeenCalledTimes(1); | ||
}); | ||
it("should throw an ArgumentError if the Wallet Network ID does not match the Address Network ID", async () => { | ||
@@ -236,0 +255,0 @@ coinbase_1.Coinbase.apiClients.wallet = utils_1.walletsApiMock; |
@@ -7,3 +7,3 @@ { | ||
"repository": "https://github.com/coinbase/coinbase-sdk-nodejs", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
@@ -10,0 +10,0 @@ "types": "dist/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
490652
9233