Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to sdk v4 docs #1279

Merged
merged 22 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arbitrum-sdk
Submodule arbitrum-sdk updated 78 files
+7 −2 .env-sample
+26 −11 .github/workflows/build-test.yml
+0 −4 .gitignore
+73 −100 README.md
+51 −12 audit-ci.jsonc
+198 −0 docs/1-introduction.mdx
+198 −0 docs/2-migrate.mdx
+9 −8 package.json
+1 −1 scripts/cancelRetryable.ts
+0 −256 scripts/deployBridge.ts
+3 −3 scripts/deployStandard.ts
+20 −10 scripts/genAbi.js
+96 −19 scripts/genNetwork.ts
+12 −32 scripts/instantiate_bridge.ts
+18 −17 scripts/lib.ts
+5 −5 scripts/redeemRetryable.ts
+4 −4 scripts/sendL2SignedMsg.ts
+87 −214 scripts/testSetup.ts
+4 −4 scripts/upgrade_weth.ts
+59 −27 src/index.ts
+2,077 −0 src/lib/abi-bold/BoldRollupUserLogic.ts
+2,175 −0 src/lib/abi-bold/factories/BoldRollupUserLogic__factory.ts
+40 −23 src/lib/assetBridger/assetBridger.ts
+618 −308 src/lib/assetBridger/erc20Bridger.ts
+209 −89 src/lib/assetBridger/ethBridger.ts
+1,642 −0 src/lib/assetBridger/l1l3Bridger.ts
+26 −0 src/lib/dataEntities/constants.ts
+1 −1 src/lib/dataEntities/message.ts
+400 −363 src/lib/dataEntities/networks.ts
+1 −1 src/lib/dataEntities/retryableData.ts
+27 −23 src/lib/dataEntities/transactionRequest.ts
+126 −74 src/lib/inbox/inbox.ts
+333 −0 src/lib/message/ChildToParentMessage.ts
+99 −87 src/lib/message/ChildToParentMessageClassic.ts
+768 −0 src/lib/message/ChildToParentMessageNitro.ts
+43 −43 src/lib/message/ChildTransaction.ts
+0 −173 src/lib/message/L1ToL2MessageCreator.ts
+0 −317 src/lib/message/L2ToL1Message.ts
+0 −558 src/lib/message/L2ToL1MessageNitro.ts
+203 −178 src/lib/message/ParentToChildMessage.ts
+231 −0 src/lib/message/ParentToChildMessageCreator.ts
+58 −53 src/lib/message/ParentToChildMessageGasEstimator.ts
+101 −87 src/lib/message/ParentTransaction.ts
+2 −1 src/lib/utils/byte_serialize_params.ts
+32 −0 src/lib/utils/calldata.ts
+31 −31 src/lib/utils/lib.ts
+2 −32 src/lib/utils/multicall.ts
+6 −0 src/lib/utils/types.ts
+6 −3 tests/fork/inbox.test.ts
+50 −21 tests/integration/childTransactionReceipt.test.ts
+283 −0 tests/integration/custom-fee-token/customFeeTokenEthBridger.test.ts
+101 −0 tests/integration/custom-fee-token/customFeeTokenTestHelpers.ts
+27 −0 tests/integration/custom-fee-token/mochaExtensions.ts
+191 −98 tests/integration/customerc20.test.ts
+202 −84 tests/integration/eth.test.ts
+0 −47 tests/integration/ethBridgeAddresses.test.ts
+43 −0 tests/integration/getArbitrumNetworkInformationFromRollup.test.ts
+0 −145 tests/integration/l1ToL2MessageCreator.test.ts
+993 −0 tests/integration/l1l3Bridger.test.ts
+169 −0 tests/integration/parentToChildMessageCreator.test.ts
+68 −0 tests/integration/parentToChildMessageGasEstimator.test.ts
+68 −32 tests/integration/retryableData.test.ts
+86 −72 tests/integration/sanity.test.ts
+149 −0 tests/integration/sendChildmsg.test.ts
+0 −143 tests/integration/sendL2msg.test.ts
+160 −85 tests/integration/standarderc20.test.ts
+199 −133 tests/integration/testHelpers.ts
+51 −46 tests/integration/weth.test.ts
+64 −0 tests/unit/calldata.test.ts
+144 −0 tests/unit/childBlocksForL1Block.test.ts
+27 −24 tests/unit/childToParentMessageEvents.test.ts
+0 −136 tests/unit/l2BlocksForL1Block.test.ts
+12 −9 tests/unit/multicall.test.ts
+223 −0 tests/unit/network.test.ts
+23 −17 tests/unit/parentToChildMessageEvents.test.ts
+16 −0 typedoc.json
+0 −0 typedoc_md.js
+659 −186 yarn.lock
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const config = {
readme: 'none',

// Output options
out: '../arbitrum-docs/sdk-docs',
out: '../arbitrum-docs/sdk-docs/reference',
hideGenerator: true,
validation: {
notExported: false,
Expand Down
45 changes: 30 additions & 15 deletions website/src/scripts/sdkDocsHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const { Application, RendererEvent } = require('typedoc');

const { parseMarkdownContentTitle } = require('@docusaurus/utils');
/**
* Plugin to move docs files from a target folder to the same folder as used by Docusaurus site.
*
Expand All @@ -15,20 +15,19 @@ const { Application, RendererEvent } = require('typedoc');
* files by leading numbers first then alphabetically.
*/
function load(app) {
const outputDir = app.options.getValue('out');
const outputDir = path.join(app.options.getValue('out'),'../');
const sourceDir = path.join(outputDir, '../../arbitrum-sdk/docs');
const targetDir = path.join(outputDir);

app.renderer.on(RendererEvent.START, async () => {
cleanDirectory(targetDir);
cleanDirectory(outputDir);
});

app.renderer.on(RendererEvent.END, async () => {
copyFiles(sourceDir, targetDir);
copyFiles(sourceDir, outputDir);

const sidebarItems = generateSidebar(targetDir);
const sidebarItems = generateSidebar(outputDir);
const sidebarConfig = { items: sidebarItems };
const sidebarPath = path.join(targetDir, 'sidebar.js');
const sidebarPath = path.join(outputDir, 'sidebar.js');

fs.writeFileSync(
sidebarPath,
Expand Down Expand Up @@ -118,17 +117,18 @@ function generateSidebar(dir, basePath = '') {
fullPath,
`${basePath}/${entry.name.replace(/^\d+-/, '')}`,
);
const label = capitalizeFirstLetter(getLabelFromFilesystem(entry.name));
return {
type: 'category',
label: generateLabel(entry.name),
label,
items: subItems,
};
} else if (entry.isFile() && entry.name.endsWith('.md')) {
} else if (entry.isFile() && (entry.name.endsWith('.md') || entry.name.endsWith('.mdx'))) {
const docId = generateId(entry.name, basePath);
return {
type: 'doc',
id: docId,
label: generateLabel(entry.name),
label: generateLabel(entry),
};
}
})
Expand All @@ -142,16 +142,31 @@ function capitalizeFirstLetter(string) {
}

function generateId(name, basePath) {
let label = name.replace(/^\d+-/, ''); //
label = label.replace(/\.md$/, '');
const label = getLabelFromFilesystem(name);
const slashIfNeeded = basePath.startsWith('/') ? '' : '/';
return 'sdk-docs' + slashIfNeeded + path.join(basePath, label);
}

function generateLabel(name) {
let label = name.replace(/^\d+-/, '');
label = label.replace(/\.md$/, '');
function generateLabel(entry) {
const filePath = `${entry.path}/${entry.name}`;
const titleFromFile = getTitleFromFileContent(filePath);
const label = titleFromFile || getLabelFromFilesystem(entry.name);
return capitalizeFirstLetter(label);
}

function getLabelFromFilesystem(name) {
const label = name.replace(/^\d+-/, '').replace(/\.md$/, '').replace(/\.mdx$/, '');
return label || '';
}

function getTitleFromFileContent(filePath) {
if (!fs.existsSync(filePath)) {
return '';
}
const fileContent = fs.readFileSync(filePath, 'utf8');
const { contentTitle } = parseMarkdownContentTitle(fileContent);

return contentTitle || '';
}

exports.load = load;