-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add getOnchainIdentifier in the reference
- Loading branch information
1 parent
c711a0c
commit e271cde
Showing
3 changed files
with
49 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"getOnchainIdentifier": "getOnchainIdentifier" | ||
} |
44 changes: 44 additions & 0 deletions
44
pages/reference-sdk-protocol-kit/onchain-tracking/getOnchainIdentifier.mdx
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,44 @@ | ||
import { Tabs } from 'nextra/components' | ||
|
||
# `getOnchainIdentifier` | ||
|
||
Returns the on-chain identifier generated internally. This identifier is appended to the `data` field of transactions to enable on-chain tracking. | ||
|
||
## Usage | ||
|
||
{/* <!-- vale off --> */} | ||
|
||
<Tabs items={['example.ts', 'setup.ts']}> | ||
<Tabs.Tab> | ||
```typescript | ||
import { protocolKit } from './setup.ts' | ||
|
||
const onchainIdentifier = await protocolKit.getOnchainIdentifier() | ||
|
||
console.log(onchainIdentifier) // e.g., '5afe006562303761323539616336346466346135306537646561393238383963' | ||
``` | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
```typescript | ||
import Safe from '@safe-global/protocol-kit' | ||
|
||
export const protocolKit = Safe.init({ | ||
// ... | ||
onchainAnalytics: { | ||
project: 'Cow Swap', // Specify your project name | ||
platform: 'Web' // Optional platform | ||
} | ||
}) | ||
``` | ||
</Tabs.Tab> | ||
</Tabs> | ||
|
||
{/* <!-- vale on --> */} | ||
|
||
## Returns | ||
|
||
`string` | ||
|
||
The on-chain identifier in hexadecimal format (e.g., `5afe00...`), which includes hashed metadata such as project name, platform, tool, and tool version. | ||
Check failure on line 42 in pages/reference-sdk-protocol-kit/onchain-tracking/getOnchainIdentifier.mdx GitHub Actions / vale-docs
|
||
|
||
For more details about the identifier format, please refer to the [On-chain identifier](../../sdk/onchain-tracking.mdx#on-chain-identifier-format) section. |