Skip to content

Commit

Permalink
chore(aptos): make movement network alias
Browse files Browse the repository at this point in the history
  • Loading branch information
zfy0701 committed Dec 4, 2024
1 parent eab9bd3 commit 0ec0148
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion examples/sui/src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ SuiObjectTypeProcessor.bind({
},
60,
60 * 24 * 30,
undefined,
{ owned: false }
)
14 changes: 7 additions & 7 deletions packages/sdk/src/aptos/codegen/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AptosNetworkCodegen extends BaseAptosCodegen {
const MAINNET_CODEGEN = new AptosNetworkCodegen(AptosNetwork.MAIN_NET)
const TESTNET_CODEGEN = new AptosNetworkCodegen(AptosNetwork.TEST_NET)
const MOVEMENT_MAINNET_CODEGEN = new AptosNetworkCodegen(AptosNetwork.MOVEMENT_MAIN_NET)
const M2_TESTNET_CODEGEN = new AptosNetworkCodegen(AptosNetwork.MOVEMENT_TEST_NET)
// const M2_TESTNET_CODEGEN = new AptosNetworkCodegen(AptosNetwork.MOVEMENT_TEST_NET)
const MOVEMENT_PROTO_CODEGEN = new AptosNetworkCodegen(AptosNetwork.MOVEMENT_PORTO)

class AptosCodegen {
Expand All @@ -75,16 +75,16 @@ class AptosCodegen {
path.join(outputDir, 'movement-mainnet'),
builtin
)
const num4 = await M2_TESTNET_CODEGEN.generate(
path.join(srcDir, 'm2-testnet'),
path.join(outputDir, 'm2-testnet'),
builtin
)
// const num4 = await M2_TESTNET_CODEGEN.generate(
// path.join(srcDir, 'm2-testnet'),
// path.join(outputDir, 'm2-testnet'),
// builtin
// )
const num5 = await MOVEMENT_PROTO_CODEGEN.generate(
path.join(srcDir, 'movement-porto'),
path.join(outputDir, 'movement-porto'),
builtin
)
return num1 + num2 + num3 + num4 + num5
return num1 + num2 + num3 + num5
}
}
2 changes: 1 addition & 1 deletion packages/sdk/src/aptos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export {
} from './aptos-processor.js'
export { AptosResourceProcessorTemplate } from './aptos-resource-processor-template.js'
export { AptosContext, AptosResourcesContext } from './context.js'
export { AptosBindOptions, AptosNetwork } from './network.js'
export { AptosBindOptions, AptosNetwork, MovementNetwork } from './network.js'
export { type ResourceChange } from '@typemove/aptos'
export * from './api.js'

Expand Down
8 changes: 6 additions & 2 deletions packages/sdk/src/aptos/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ export const AptosNetwork = <const>{
TEST_NET: AptosChainId.APTOS_TESTNET,
// DEV_NET: AptosChainId.APTOS_DEVNET,
MOVEMENT_MAIN_NET: AptosChainId.APTOS_MOVEMENT_MAINNET,
MOVEMENT_TEST_NET: AptosChainId.APTOS_MOVEMENT_TESTNET,
MOVEMENT_PORTO: AptosChainId.APTOS_MOVEMENT_PORTO
}

export const MovementNetwork = <const>{
MAIN_NET: AptosChainId.APTOS_MOVEMENT_MAINNET,
PORTO: AptosChainId.APTOS_MOVEMENT_PORTO
}

export class AptosBindOptions {
address: string
network?: AptosNetwork = AptosNetwork.MAIN_NET
Expand All @@ -27,7 +31,7 @@ export function getRpcEndpoint(network: AptosNetwork): string {
return 'https://mainnet.aptoslabs.com/v1'
case AptosNetwork.TEST_NET:
return 'https://testnet.aptoslabs.com/v1'
case AptosNetwork.MOVEMENT_TEST_NET:
case AptosChainId.APTOS_MOVEMENT_TESTNET:
return 'https://aptos.testnet.suzuka.movementlabs.xyz/v1'
case AptosNetwork.MOVEMENT_MAIN_NET:
return 'https://mainnet.movementnetwork.xyz/v1'
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/sui/tests/sui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('Test Sui Example', () => {
},
60,
60,
undefined,
{ owned: false }
)
})
Expand Down

0 comments on commit 0ec0148

Please sign in to comment.