Comparing version 1.2.0 to 1.3.0
@@ -30,2 +30,5 @@ import fs from 'fs'; | ||
}); | ||
test('getBlock(blockId=null)', () => { | ||
return expect(getBlock()).resolves.not.toThrow(); | ||
}); | ||
test('getCode()', () => { | ||
@@ -36,2 +39,7 @@ return expect( | ||
}); | ||
test('getCode(blockId=null)', () => { | ||
return expect( | ||
getCode('0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d') | ||
).resolves.not.toThrow(); | ||
}); | ||
test('getStorageAt()', () => { | ||
@@ -42,2 +50,7 @@ return expect( | ||
}); | ||
test('getStorageAt(blockId=null)', () => { | ||
return expect( | ||
getStorageAt('0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d', 0) | ||
).resolves.not.toThrow(); | ||
}); | ||
test('getTransactionStatus()', () => { | ||
@@ -44,0 +57,0 @@ return expect(getTransactionStatus(286136)).resolves.not.toThrow(); |
@@ -0,1 +1,7 @@ | ||
# [1.3.0](https://github.com/seanjameshan/starknet.js/compare/v1.2.0...v1.3.0) (2021-10-28) | ||
### Features | ||
- allow optional blockId ([fbd09ba](https://github.com/seanjameshan/starknet.js/commit/fbd09ba8458caf9a5c0ac0b84a9955c413524292)) | ||
# [1.2.0](https://github.com/seanjameshan/starknet.js/compare/v1.1.1...v1.2.0) (2021-10-27) | ||
@@ -2,0 +8,0 @@ |
@@ -28,3 +28,3 @@ import { compressProgram } from './utils'; | ||
*/ | ||
export declare function getBlock(blockId: number): Promise<GetBlockResponse>; | ||
export declare function getBlock(blockId?: number): Promise<GetBlockResponse>; | ||
/** | ||
@@ -39,3 +39,3 @@ * Gets the code of the deployed contract. | ||
*/ | ||
export declare function getCode(contractAddress: string, blockId: number): Promise<GetCodeResponse>; | ||
export declare function getCode(contractAddress: string, blockId?: number): Promise<GetCodeResponse>; | ||
/** | ||
@@ -51,3 +51,3 @@ * Gets the contract's storage variable at a specific key. | ||
*/ | ||
export declare function getStorageAt(contractAddress: string, key: number, blockId: number): Promise<object>; | ||
export declare function getStorageAt(contractAddress: string, key: number, blockId?: number): Promise<object>; | ||
/** | ||
@@ -54,0 +54,0 @@ * Gets the status of a transaction. |
@@ -107,3 +107,3 @@ "use strict"; | ||
axios_1.default | ||
.get(FEEDER_GATEWAY_URL + "/get_block?blockId=" + blockId) | ||
.get(FEEDER_GATEWAY_URL + "/get_block?blockId=" + (blockId !== null && blockId !== void 0 ? blockId : 'null')) | ||
.then(function (resp) { | ||
@@ -128,3 +128,3 @@ resolve(resp.data); | ||
axios_1.default | ||
.get(FEEDER_GATEWAY_URL + "/get_code?contractAddress=" + contractAddress + "&blockId=" + blockId) | ||
.get(FEEDER_GATEWAY_URL + "/get_code?contractAddress=" + contractAddress + "&blockId=" + (blockId !== null && blockId !== void 0 ? blockId : 'null')) | ||
.then(function (resp) { | ||
@@ -151,3 +151,3 @@ resolve(resp.data); | ||
axios_1.default | ||
.get(FEEDER_GATEWAY_URL + "/get_storage_at?contractAddress=" + contractAddress + "&key=" + key + "&blockId=" + blockId) | ||
.get(FEEDER_GATEWAY_URL + "/get_storage_at?contractAddress=" + contractAddress + "&key=" + key + "&blockId=" + (blockId !== null && blockId !== void 0 ? blockId : 'null')) | ||
.then(function (resp) { | ||
@@ -154,0 +154,0 @@ resolve(resp.data); |
{ | ||
"name": "starknet", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "JavaScript library for StarkNet", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -65,6 +65,6 @@ import axios from 'axios'; | ||
*/ | ||
export function getBlock(blockId: number): Promise<GetBlockResponse> { | ||
export function getBlock(blockId?: number): Promise<GetBlockResponse> { | ||
return new Promise((resolve, reject) => { | ||
axios | ||
.get<GetBlockResponse>(`${FEEDER_GATEWAY_URL}/get_block?blockId=${blockId}`) | ||
.get<GetBlockResponse>(`${FEEDER_GATEWAY_URL}/get_block?blockId=${blockId ?? 'null'}`) | ||
.then((resp: any) => { | ||
@@ -86,7 +86,9 @@ resolve(resp.data); | ||
*/ | ||
export function getCode(contractAddress: string, blockId: number): Promise<GetCodeResponse> { | ||
export function getCode(contractAddress: string, blockId?: number): Promise<GetCodeResponse> { | ||
return new Promise((resolve, reject) => { | ||
axios | ||
.get<GetCodeResponse>( | ||
`${FEEDER_GATEWAY_URL}/get_code?contractAddress=${contractAddress}&blockId=${blockId}` | ||
`${FEEDER_GATEWAY_URL}/get_code?contractAddress=${contractAddress}&blockId=${ | ||
blockId ?? 'null' | ||
}` | ||
) | ||
@@ -114,3 +116,3 @@ .then((resp) => { | ||
key: number, | ||
blockId: number | ||
blockId?: number | ||
): Promise<object> { | ||
@@ -120,3 +122,5 @@ return new Promise((resolve, reject) => { | ||
.get( | ||
`${FEEDER_GATEWAY_URL}/get_storage_at?contractAddress=${contractAddress}&key=${key}&blockId=${blockId}` | ||
`${FEEDER_GATEWAY_URL}/get_storage_at?contractAddress=${contractAddress}&key=${key}&blockId=${ | ||
blockId ?? 'null' | ||
}` | ||
) | ||
@@ -123,0 +127,0 @@ .then((resp: any) => { |
@@ -42,3 +42,3 @@ import { compressProgram } from './utils'; | ||
*/ | ||
export declare function getBlock(blockId: number): Promise<GetBlockResponse>; | ||
export declare function getBlock(blockId?: number): Promise<GetBlockResponse>; | ||
/** | ||
@@ -53,3 +53,6 @@ * Gets the code of the deployed contract. | ||
*/ | ||
export declare function getCode(contractAddress: string, blockId: number): Promise<GetCodeResponse>; | ||
export declare function getCode( | ||
contractAddress: string, | ||
blockId?: number | ||
): Promise<GetCodeResponse>; | ||
/** | ||
@@ -68,3 +71,3 @@ * Gets the contract's storage variable at a specific key. | ||
key: number, | ||
blockId: number | ||
blockId?: number | ||
): Promise<object>; | ||
@@ -71,0 +74,0 @@ /** |
@@ -222,3 +222,7 @@ 'use strict'; | ||
axios_1.default | ||
.get(FEEDER_GATEWAY_URL + '/get_block?blockId=' + blockId) | ||
.get( | ||
FEEDER_GATEWAY_URL + | ||
'/get_block?blockId=' + | ||
(blockId !== null && blockId !== void 0 ? blockId : 'null') | ||
) | ||
.then(function (resp) { | ||
@@ -244,3 +248,7 @@ resolve(resp.data); | ||
.get( | ||
FEEDER_GATEWAY_URL + '/get_code?contractAddress=' + contractAddress + '&blockId=' + blockId | ||
FEEDER_GATEWAY_URL + | ||
'/get_code?contractAddress=' + | ||
contractAddress + | ||
'&blockId=' + | ||
(blockId !== null && blockId !== void 0 ? blockId : 'null') | ||
) | ||
@@ -275,3 +283,3 @@ .then(function (resp) { | ||
'&blockId=' + | ||
blockId | ||
(blockId !== null && blockId !== void 0 ? blockId : 'null') | ||
) | ||
@@ -278,0 +286,0 @@ .then(function (resp) { |
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
5001358
128396