-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: breaking api changes (#105)
* refactor: breaking api changes * refactor: add owner to SOC interface * feat: add /soc endpoint module * fix: soc owner calculation * chore: fix linter issues * fix: add ReferenceResponse to types * fix: comment out beeinfra version change * chore: cleanup * docs: add comment to CI script * fix: workaround for settlements bug ethersphere/bee#1212 * refactor: requested changes * fix: settlements bug * test: change ci to run Bee 0.5.0
- Loading branch information
Showing
13 changed files
with
149 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ReferenceResponse, UploadOptions } from '../types' | ||
import { extractUploadHeaders } from '../utils/headers' | ||
import { safeAxios } from '../utils/safeAxios' | ||
|
||
const socEndpoint = '/soc' | ||
|
||
/** | ||
* Upload single owner chunk (SOC) to a Bee node | ||
* | ||
* @param url Bee URL | ||
* @param owner Owner's ethereum address in hex | ||
* @param identifier Arbitrary identifier in hex | ||
* @param signature Signature in hex | ||
* @param data Content addressed chunk data to be uploaded | ||
* @param options Aditional options like tag, encryption, pinning | ||
*/ | ||
export async function upload( | ||
url: string, | ||
owner: string, | ||
identifier: string, | ||
signature: string, | ||
data: Uint8Array, | ||
options?: UploadOptions, | ||
): Promise<ReferenceResponse> { | ||
const response = await safeAxios<ReferenceResponse>({ | ||
method: 'post', | ||
url: `${url}${socEndpoint}/${owner}/${identifier}`, | ||
data, | ||
headers: { | ||
'content-type': 'application/octet-stream', | ||
...extractUploadHeaders(options), | ||
}, | ||
responseType: 'json', | ||
params: { sig: signature }, | ||
}) | ||
|
||
return response.data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.